TRAVIS_OS_NAME=linux <<<<<< ENV .gitignore .travis.yml AminoAcidFighter.pri AminoAcidFighter.pro AminoAcidFighter.qrc AminoAcidFighterConsole.pro AminoAcidFighterSfml.pri AminoAcidFighterSfmlTest.pri AminoAcidFighterSfmlTest.pro AminoAcidFighterTest.pro AminoAcidFighter_Test.pro Aspartic_acid.png Codecov.png CppAminoAcid/CppAminoAcid.pri CppAminoAcid/Licence.txt CppAminoAcid/aafaminoacid.cpp CppAminoAcid/aafaminoacid.h CppAminoAcid/aafaminoacids.cpp CppAminoAcid/aafaminoacids.h CppAminoAcid/aafatom.cpp CppAminoAcid/aafatom.h CppAminoAcid/aafatomtype.cpp CppAminoAcid/aafatomtype.h CppAminoAcid/aafbond.cpp CppAminoAcid/aafbond.h CppAminoAcid/aaffwd.h CppAminoAcid/aafmolecule.cpp CppAminoAcid/aafmolecule.h CppAminoAcid/aafmoleculefactory.cpp CppAminoAcid/aafmoleculefactory.h Glutamic_acid.png LICENSE Pictures/20170606.png Pictures/AminoAcidFighterGame.png Pictures/AminoAcidFighterMenu.png Pictures/AminoAcidFighterMenu2.png Pictures/AminoAcidFighterMenu_0_9.png Pictures/AminoAcidFighter_0_9.png Pictures/AminoAcids/Alanine.png Pictures/AminoAcids/AminoAcidFiles/Alanine.odg Pictures/AminoAcids/AminoAcidFiles/Arginine.odg Pictures/AminoAcids/AminoAcidFiles/Asparagine.odg Pictures/AminoAcids/AminoAcidFiles/AsparticAcid.odg Pictures/AminoAcids/AminoAcidFiles/Cysteine.odg Pictures/AminoAcids/AminoAcidFiles/GlutamicAcid.odg Pictures/AminoAcids/AminoAcidFiles/Glutamine.odg Pictures/AminoAcids/AminoAcidFiles/Glycine.odg Pictures/AminoAcids/AminoAcidFiles/Histidine.odg Pictures/AminoAcids/AminoAcidFiles/Isoleucine.odg Pictures/AminoAcids/AminoAcidFiles/Leucine.odg Pictures/AminoAcids/AminoAcidFiles/Lysine.odg Pictures/AminoAcids/AminoAcidFiles/Methionine.odg Pictures/AminoAcids/AminoAcidFiles/Phenylalanine.odg Pictures/AminoAcids/AminoAcidFiles/Proline.odg Pictures/AminoAcids/AminoAcidFiles/Serine.odg Pictures/AminoAcids/AminoAcidFiles/Threonine.odg Pictures/AminoAcids/AminoAcidFiles/Tryptophan.odg Pictures/AminoAcids/AminoAcidFiles/Tyrosine.odg Pictures/AminoAcids/AminoAcidFiles/Valine.odg Pictures/AminoAcids/Arginine.png Pictures/AminoAcids/Asparagine.png Pictures/AminoAcids/Aspartic_acid.png Pictures/AminoAcids/Cysteine.png Pictures/AminoAcids/Glutamic_acid.png Pictures/AminoAcids/Glutamine.png Pictures/AminoAcids/Glycine.png Pictures/AminoAcids/Histidine.png Pictures/AminoAcids/Isoleucine.png Pictures/AminoAcids/Leucine.png Pictures/AminoAcids/Lysine.png Pictures/AminoAcids/Methionine.png Pictures/AminoAcids/Phenylalanine.png Pictures/AminoAcids/Proline.png Pictures/AminoAcids/Serine.png Pictures/AminoAcids/Threonine.png Pictures/AminoAcids/Tryptophan.png Pictures/AminoAcids/Tyrosine.png Pictures/AminoAcids/Valine.png Pictures/AminoAcids/tmp.txt Pictures/BackgroundAminoAcidFighter.png Pictures/Bullet.png README.md TravisCI.png Whitespace.png action.cpp action.h amino_acid.cpp amino_acid.h amino_acid_fighter_tune.wav amino_acid_test.cpp arial.ttf bullet.cpp bullet.h bullet_sfml.cpp bullet_sfml.h bullet_sfml_test.cpp bullet_test.cpp choose_amino_acids_menu.cpp choose_amino_acids_menu.h choose_amino_acids_menu_sfml.cpp choose_amino_acids_menu_sfml.h choose_amino_acids_menu_sfml_test.cpp choose_n_players_menu.cpp choose_n_players_menu.h choose_n_players_menu_sfml.cpp choose_n_players_menu_sfml.h choose_n_players_menu_sfml_test.cpp do_clang-tidy do_oclint game.cpp game.h game_sfml.cpp game_sfml.h game_sfml_test.cpp game_state.cpp game_state.h game_test.cpp get_code_cov gprof.log helper.cpp helper.h helper_test.cpp install_oclint main.cpp main_console.cpp main_sfml_test.cpp main_test.cpp menu_sfml.cpp menu_sfml.h menu_sfml_test.cpp menu_test.cpp pics/TravisCI.png player.cpp player.h player_sfml.cpp player_sfml.h player_sfml_test.cpp player_test.cpp power.cpp power.h power_test.cpp program.cpp program.h program_sfml.cpp program_sfml.h program_sfml_test.cpp program_state.cpp program_state.h scripts/check_dead_links sprites_sfml.cpp sprites_sfml.h sprites_sfml_test.cpp winner_screen.cpp winner_screen.h winner_screen_sfml.cpp winner_screen_sfml.h winner_screen_sfml_test.cpp <<<<<< network # path=/home/travis/build/richelbilderbeek/AminoAcidFighter/player_test.cpp.gcov -: 0:Source:player_test.cpp -: 0:Programs:19 -: 1:#include -: 2:#include "helper.h" -: 3:#include "player.h" -: 4:#include "game.h" -: 5: function _ZN19player_construction11test_methodEv called 1 returned 100% blocks executed 67% function _ZL27player_construction_invokerv called 1 returned 100% blocks executed 100% 3: 6:BOOST_AUTO_TEST_CASE(player_construction) call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% branch 10 taken 100% (fallthrough) branch 11 taken 0% (throw) call 12 returned 100% branch 13 taken 100% (fallthrough) branch 14 taken 0% (throw) call 15 returned 100% call 16 returned 100% call 17 never executed call 18 never executed call 19 never executed call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) -: 7:{ 1: 8: const amino_acid any_amino_acid = amino_acid::cysteine; 1: 9: const double x{12.34}; 1: 10: const double y{23.45}; -: 11: const player p( -: 12: any_amino_acid, -: 13: x, -: 14: y 1: 15: ); call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% (throw) -: 16: 1: 17: BOOST_CHECK(p.get_amino_acid() == any_amino_acid); call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% (throw) call 3 returned 100% call 4 returned 100% call 5 returned 100% call 6 returned 100% call 7 returned 100% branch 8 taken 100% (fallthrough) branch 9 taken 0% (throw) call 10 returned 100% call 11 returned 100% call 12 returned 100% call 13 returned 100% branch 14 taken 100% (fallthrough) branch 15 taken 0% (throw) call 16 returned 100% call 17 returned 100% branch 18 taken 100% (fallthrough) branch 19 taken 0% (throw) call 20 returned 100% call 21 returned 100% call 22 returned 100% call 23 returned 100% branch 24 taken 100% (fallthrough) branch 25 taken 0% (throw) call 26 returned 100% call 27 returned 100% branch 28 taken 100% (fallthrough) branch 29 taken 0% (throw) call 30 returned 100% call 31 returned 100% call 32 returned 100% branch 33 taken 0% (fallthrough) branch 34 taken 100% branch 35 taken 0% (fallthrough) branch 36 taken 100% call 37 never executed call 38 never executed call 39 never executed 1: 18: BOOST_CHECK_EQUAL(p.get_x(), x); call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% (throw) call 3 returned 100% call 4 returned 100% call 5 returned 100% call 6 returned 100% call 7 returned 100% branch 8 taken 100% (fallthrough) branch 9 taken 0% (throw) call 10 returned 100% call 11 returned 100% call 12 returned 100% call 13 returned 100% branch 14 taken 100% (fallthrough) branch 15 taken 0% (throw) call 16 returned 100% call 17 returned 100% branch 18 taken 100% (fallthrough) branch 19 taken 0% (throw) call 20 returned 100% call 21 returned 100% call 22 returned 100% branch 23 taken 100% (fallthrough) branch 24 taken 0% (throw) call 25 returned 100% call 26 returned 100% branch 27 taken 0% (fallthrough) branch 28 taken 100% branch 29 taken 0% (fallthrough) branch 30 taken 100% call 31 never executed call 32 never executed 1: 19: BOOST_CHECK_EQUAL(p.get_y(), y); call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% (throw) call 3 returned 100% call 4 returned 100% call 5 returned 100% call 6 returned 100% call 7 returned 100% branch 8 taken 100% (fallthrough) branch 9 taken 0% (throw) call 10 returned 100% call 11 returned 100% call 12 returned 100% call 13 returned 100% branch 14 taken 100% (fallthrough) branch 15 taken 0% (throw) call 16 returned 100% call 17 returned 100% branch 18 taken 100% (fallthrough) branch 19 taken 0% (throw) call 20 returned 100% call 21 returned 100% call 22 returned 100% branch 23 taken 100% (fallthrough) branch 24 taken 0% (throw) call 25 returned 100% call 26 returned 100% branch 27 taken 0% (fallthrough) branch 28 taken 100% branch 29 taken 0% (fallthrough) branch 30 taken 100% call 31 never executed call 32 never executed 1: 20:} -: 21: function _ZN36tyrosine_has_shield_as_special_power11test_methodEv called 1 returned 100% blocks executed 71% function _ZL44tyrosine_has_shield_as_special_power_invokerv called 1 returned 100% blocks executed 100% 3: 22:BOOST_AUTO_TEST_CASE(tyrosine_has_shield_as_special_power) call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% branch 10 taken 100% (fallthrough) branch 11 taken 0% (throw) call 12 returned 100% branch 13 taken 100% (fallthrough) branch 14 taken 0% (throw) call 15 returned 100% call 16 returned 100% call 17 never executed call 18 never executed call 19 never executed call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) -: 23:{ 1: 24: BOOST_CHECK(get_power(amino_acid::tyrosine) == power::shield); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% call 21 returned 100% branch 22 taken 100% (fallthrough) branch 23 taken 0% (throw) call 24 returned 100% call 25 returned 100% branch 26 taken 100% (fallthrough) branch 27 taken 0% (throw) call 28 returned 100% call 29 returned 100% call 30 returned 100% branch 31 taken 0% (fallthrough) branch 32 taken 100% branch 33 taken 0% (fallthrough) branch 34 taken 100% call 35 never executed call 36 never executed call 37 never executed call 38 never executed 1: 25:} -: 26: function _ZN43player_start_using_power_starts_using_power11test_methodEv called 1 returned 100% blocks executed 70% function _ZL51player_start_using_power_starts_using_power_invokerv called 1 returned 100% blocks executed 100% 3: 27:BOOST_AUTO_TEST_CASE(player_start_using_power_starts_using_power) call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% branch 10 taken 100% (fallthrough) branch 11 taken 0% (throw) call 12 returned 100% branch 13 taken 100% (fallthrough) branch 14 taken 0% (throw) call 15 returned 100% call 16 returned 100% call 17 never executed call 18 never executed call 19 never executed call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) -: 28:{ 2: 29: game g = create_test_game_1(); call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% (throw) call 3 returned 100% call 4 never executed 1: 30: player& p = get_player(g, 0); call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% (throw) call 3 returned 100% 1: 31: BOOST_CHECK(!p.uses_power()); call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% (throw) call 3 returned 100% call 4 returned 100% call 5 returned 100% call 6 returned 100% call 7 returned 100% branch 8 taken 100% (fallthrough) branch 9 taken 0% (throw) call 10 returned 100% call 11 returned 100% call 12 returned 100% call 13 returned 100% branch 14 taken 100% (fallthrough) branch 15 taken 0% (throw) call 16 returned 100% call 17 returned 100% branch 18 taken 100% (fallthrough) branch 19 taken 0% (throw) call 20 returned 100% call 21 returned 100% call 22 returned 100% call 23 returned 100% branch 24 taken 100% (fallthrough) branch 25 taken 0% (throw) call 26 returned 100% branch 27 taken 100% (fallthrough) branch 28 taken 0% (throw) call 29 returned 100% call 30 returned 100% branch 31 taken 100% (fallthrough) branch 32 taken 0% (throw) call 33 returned 100% call 34 returned 100% call 35 returned 100% branch 36 taken 0% (fallthrough) branch 37 taken 100% branch 38 taken 0% (fallthrough) branch 39 taken 100% call 40 never executed call 41 never executed call 42 never executed 1: 32: p.start_using_power(g); call 0 returned 100% call 1 returned 100% branch 2 taken 100% (fallthrough) branch 3 taken 0% (throw) 1: 33: BOOST_CHECK(p.uses_power()); call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% (throw) call 3 returned 100% call 4 returned 100% call 5 returned 100% call 6 returned 100% call 7 returned 100% branch 8 taken 100% (fallthrough) branch 9 taken 0% (throw) call 10 returned 100% call 11 returned 100% call 12 returned 100% call 13 returned 100% branch 14 taken 100% (fallthrough) branch 15 taken 0% (throw) call 16 returned 100% call 17 returned 100% branch 18 taken 100% (fallthrough) branch 19 taken 0% (throw) call 20 returned 100% call 21 returned 100% call 22 returned 100% call 23 returned 100% branch 24 taken 100% (fallthrough) branch 25 taken 0% (throw) call 26 returned 100% branch 27 taken 100% (fallthrough) branch 28 taken 0% (throw) call 29 returned 100% call 30 returned 100% branch 31 taken 100% (fallthrough) branch 32 taken 0% (throw) call 33 returned 100% call 34 returned 100% call 35 returned 100% branch 36 taken 0% (fallthrough) branch 37 taken 100% branch 38 taken 0% (fallthrough) branch 39 taken 100% call 40 never executed call 41 never executed call 42 never executed 1: 34:} -: 35: function _ZN33player_using_power_has_a_duration11test_methodEv called 1 returned 100% blocks executed 71% function _ZL41player_using_power_has_a_duration_invokerv called 1 returned 100% blocks executed 100% 3: 36:BOOST_AUTO_TEST_CASE(player_using_power_has_a_duration) call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% branch 10 taken 100% (fallthrough) branch 11 taken 0% (throw) call 12 returned 100% branch 13 taken 100% (fallthrough) branch 14 taken 0% (throw) call 15 returned 100% call 16 returned 100% call 17 never executed call 18 never executed call 19 returned 100% branch 20 taken 100% (fallthrough) branch 21 taken 0% (throw) -: 37:{ 2: 38: game g = create_test_game_1(); call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% (throw) call 3 returned 100% call 4 never executed 1: 39: player& p = get_player(g, 0); call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% (throw) call 3 returned 100% 1: 40: p.start_using_power(g); call 0 returned 100% call 1 returned 100% branch 2 taken 100% (fallthrough) branch 3 taken 0% (throw) 1: 41: BOOST_CHECK(p.uses_power()); call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% (throw) call 3 returned 100% call 4 returned 100% call 5 returned 100% call 6 returned 100% call 7 returned 100% branch 8 taken 100% (fallthrough) branch 9 taken 0% (throw) call 10 returned 100% call 11 returned 100% call 12 returned 100% call 13 returned 100% branch 14 taken 100% (fallthrough) branch 15 taken 0% (throw) call 16 returned 100% call 17 returned 100% branch 18 taken 100% (fallthrough) branch 19 taken 0% (throw) call 20 returned 100% call 21 returned 100% call 22 returned 100% call 23 returned 100% branch 24 taken 100% (fallthrough) branch 25 taken 0% (throw) call 26 returned 100% branch 27 taken 100% (fallthrough) branch 28 taken 0% (throw) call 29 returned 100% call 30 returned 100% branch 31 taken 100% (fallthrough) branch 32 taken 0% (throw) call 33 returned 100% call 34 returned 100% call 35 returned 100% branch 36 taken 0% (fallthrough) branch 37 taken 100% branch 38 taken 0% (fallthrough) branch 39 taken 100% call 40 never executed call 41 never executed call 42 never executed 101: 42: for (int i=0; i!=100; ++i) branch 0 taken 99% (fallthrough) branch 1 taken 1% call 2 returned 100% -: 43: { 100: 44: g.tick(); call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% (throw) -: 45: } 1: 46: BOOST_CHECK(!p.uses_power()); call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% (throw) call 3 returned 100% call 4 returned 100% call 5 returned 100% call 6 returned 100% call 7 returned 100% branch 8 taken 100% (fallthrough) branch 9 taken 0% (throw) call 10 returned 100% call 11 returned 100% call 12 returned 100% call 13 returned 100% branch 14 taken 100% (fallthrough) branch 15 taken 0% (throw) call 16 returned 100% call 17 returned 100% branch 18 taken 100% (fallthrough) branch 19 taken 0% (throw) call 20 returned 100% call 21 returned 100% call 22 returned 100% call 23 returned 100% branch 24 taken 100% (fallthrough) branch 25 taken 0% (throw) call 26 returned 100% branch 27 taken 100% (fallthrough) branch 28 taken 0% (throw) call 29 returned 100% call 30 returned 100% branch 31 taken 100% (fallthrough) branch 32 taken 0% (throw) call 33 returned 100% call 34 returned 100% call 35 returned 100% branch 36 taken 0% (fallthrough) branch 37 taken 100% branch 38 taken 0% (fallthrough) branch 39 taken 100% call 40 never executed call 41 never executed call 42 never executed function _GLOBAL__sub_I_player_test.cpp called 1 returned 100% blocks executed 100% function _Z41__static_initialization_and_destruction_0ii called 1 returned 100% blocks executed 78% 4: 47:} call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% branch 3 taken 100% (fallthrough) branch 4 taken 0% <<<<<< EOF # path=/home/travis/build/richelbilderbeek/AminoAcidFighter/amino_acid.cpp.gcov -: 0:Source:amino_acid.cpp -: 0:Programs:19 -: 1:#include "amino_acid.h" -: 2: -: 3:#include -: 4: function _Z6to_strB5cxx1110amino_acid called 40 returned 100% blocks executed 99% 40: 5:std::string to_str(const amino_acid a) noexcept //!OCLINT cannot make this any shorter -: 6:{ 40: 7: switch (a) { branch 0 taken 5% branch 1 taken 5% branch 2 taken 5% branch 3 taken 5% branch 4 taken 5% branch 5 taken 5% branch 6 taken 5% branch 7 taken 5% branch 8 taken 5% branch 9 taken 5% branch 10 taken 5% branch 11 taken 5% branch 12 taken 5% branch 13 taken 5% branch 14 taken 5% branch 15 taken 5% branch 16 taken 5% branch 17 taken 5% branch 18 taken 5% branch 19 taken 5% branch 20 taken 0% 2: 8: case amino_acid::alanine: return "Alanine" ; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 9: case amino_acid::arginine: return "Arginine" ; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 10: case amino_acid::asparagine: return "Asparagine" ; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 11: case amino_acid::aspartic_acid: return "Aspartic_acid"; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 12: case amino_acid::cysteine: return "Cysteine" ; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 13: case amino_acid::glutamic_acid: return "Glutamic_acid"; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 14: case amino_acid::glutamine: return "Glutamine" ; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 15: case amino_acid::glycine: return "Glycine" ; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 16: case amino_acid::histidine: return "Histidine" ; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 17: case amino_acid::isoleucine: return "Isoleucine" ; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 18: case amino_acid::leucine: return "Leucine" ; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 19: case amino_acid::lysine: return "Lysine" ; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 20: case amino_acid::methionine: return "Methionine" ; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 21: case amino_acid::phenylalanine: return "Phenylalanine"; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 22: case amino_acid::proline: return "Proline" ; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 23: case amino_acid::serine: return "Serine" ; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 24: case amino_acid::threonine: return "Threonine" ; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 25: case amino_acid::tryptophan: return "Tryptophan" ; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 26: case amino_acid::tyrosine: return "Tyrosine" ; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 27: case amino_acid::valine: return "Valine" ; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% -: 28: } #####: 29: assert(!"Should not get here"); //!OCLINT accepted idiom call 0 never executed -: 30: return ""; -: 31:} -: 32: function _Z19get_all_amino_acidsv called 1 returned 100% blocks executed 100% 1: 33:std::vector get_all_amino_acids() noexcept -: 34:{ -: 35: return -: 36: { -: 37: amino_acid::alanine, -: 38: amino_acid::arginine, -: 39: amino_acid::asparagine, -: 40: amino_acid::aspartic_acid, -: 41: amino_acid::cysteine, -: 42: amino_acid::glutamic_acid, -: 43: amino_acid::glutamine, -: 44: amino_acid::glycine, -: 45: amino_acid::histidine, -: 46: amino_acid::isoleucine, -: 47: amino_acid::leucine, -: 48: amino_acid::lysine, -: 49: amino_acid::methionine, -: 50: amino_acid::phenylalanine, -: 51: amino_acid::proline, -: 52: amino_acid::serine, -: 53: amino_acid::threonine, -: 54: amino_acid::tryptophan, -: 55: amino_acid::tyrosine, -: 56: amino_acid::valine 1: 57: }; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% -: 58:} -: 59: -: 60:/// Get the previous amino acid in the alphabet function _Z8get_prev10amino_acid called 3 returned 100% blocks executed 100% 3: 61:amino_acid get_prev(const amino_acid in) -: 62:{ 3: 63: const int player = static_cast(in); 3: 64: if (player > 0) branch 0 taken 67% (fallthrough) branch 1 taken 33% -: 65: { 2: 66: return static_cast(player - 1); call 0 returned 100% -: 67: } 1: 68: return in; -: 69:} -: 70: function _Z8get_next10amino_acid called 3 returned 100% blocks executed 100% 3: 71:amino_acid get_next(const amino_acid in) -: 72:{ 3: 73: const int player = static_cast(in); 3: 74: if(player < 19) branch 0 taken 67% (fallthrough) branch 1 taken 33% -: 75: { 2: 76: return static_cast(player + 1); call 0 returned 100% -: 77: } 1: 78: return in; -: 79:} <<<<<< EOF # path=/home/travis/build/richelbilderbeek/AminoAcidFighter/#usr#include#x86_64-linux-gnu#qt5#QtCore#qatomic_x86.h.gcov -: 0:Source:/usr/include/x86_64-linux-gnu/qt5/QtCore/qatomic_x86.h -: 0:Programs:19 -: 1:/**************************************************************************** -: 2:** -: 3:** Copyright (C) 2015 The Qt Company Ltd. -: 4:** Copyright (C) 2011 Thiago Macieira -: 5:** Contact: http://www.qt.io/licensing/ -: 6:** -: 7:** This file is part of the QtCore module of the Qt Toolkit. -: 8:** -: 9:** $QT_BEGIN_LICENSE:LGPL21$ -: 10:** Commercial License Usage -: 11:** Licensees holding valid commercial Qt licenses may use this file in -: 12:** accordance with the commercial license agreement provided with the -: 13:** Software or, alternatively, in accordance with the terms contained in -: 14:** a written agreement between you and The Qt Company. For licensing terms -: 15:** and conditions see http://www.qt.io/terms-conditions. For further -: 16:** information use the contact form at http://www.qt.io/contact-us. -: 17:** -: 18:** GNU Lesser General Public License Usage -: 19:** Alternatively, this file may be used under the terms of the GNU Lesser -: 20:** General Public License version 2.1 or version 3 as published by the Free -: 21:** Software Foundation and appearing in the file LICENSE.LGPLv21 and -: 22:** LICENSE.LGPLv3 included in the packaging of this file. Please review the -: 23:** following information to ensure the GNU Lesser General Public License -: 24:** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -: 25:** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -: 26:** -: 27:** As a special exception, The Qt Company gives you certain additional -: 28:** rights. These rights are described in The Qt Company LGPL Exception -: 29:** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -: 30:** -: 31:** $QT_END_LICENSE$ -: 32:** -: 33:****************************************************************************/ -: 34: -: 35:#ifndef QATOMIC_X86_H -: 36:#define QATOMIC_X86_H -: 37: -: 38:#include -: 39: -: 40:QT_BEGIN_NAMESPACE -: 41: -: 42:#if 0 -: 43:// silence syncqt warnings -: 44:QT_END_NAMESPACE -: 45:#pragma qt_sync_skip_header_check -: 46:#pragma qt_sync_stop_processing -: 47:#endif -: 48: -: 49:#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE -: 50:#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_WAIT_FREE -: 51: -: 52:#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE -: 53:#define Q_ATOMIC_INT_TEST_AND_SET_IS_WAIT_FREE -: 54: -: 55:#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE -: 56:#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE -: 57: -: 58:#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE -: 59:#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_WAIT_FREE -: 60: -: 61:#define Q_ATOMIC_INT32_IS_SUPPORTED -: 62: -: 63:#define Q_ATOMIC_INT32_REFERENCE_COUNTING_IS_ALWAYS_NATIVE -: 64:#define Q_ATOMIC_INT32_REFERENCE_COUNTING_IS_WAIT_FREE -: 65: -: 66:#define Q_ATOMIC_INT32_TEST_AND_SET_IS_ALWAYS_NATIVE -: 67:#define Q_ATOMIC_INT32_TEST_AND_SET_IS_WAIT_FREE -: 68: -: 69:#define Q_ATOMIC_INT32_FETCH_AND_STORE_IS_ALWAYS_NATIVE -: 70:#define Q_ATOMIC_INT32_FETCH_AND_STORE_IS_WAIT_FREE -: 71: -: 72:#define Q_ATOMIC_INT32_FETCH_AND_ADD_IS_ALWAYS_NATIVE -: 73:#define Q_ATOMIC_INT32_FETCH_AND_ADD_IS_WAIT_FREE -: 74: -: 75:#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE -: 76:#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_WAIT_FREE -: 77: -: 78:#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE -: 79:#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE -: 80: -: 81:#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE -: 82:#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_WAIT_FREE -: 83: -: 84:template struct QBasicAtomicOps: QGenericAtomicOps > -: 85:{ -: 86: static inline Q_DECL_CONSTEXPR bool isReferenceCountingNative() Q_DECL_NOTHROW { return true; } -: 87: static inline Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() Q_DECL_NOTHROW { return true; } -: 88: template static bool ref(T &_q_value) Q_DECL_NOTHROW; -: 89: template static bool deref(T &_q_value) Q_DECL_NOTHROW; -: 90: -: 91: static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() Q_DECL_NOTHROW { return true; } -: 92: static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return true; } -: 93: template static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW; -: 94: template static bool -: 95: testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW; -: 96: -: 97: static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() Q_DECL_NOTHROW { return true; } -: 98: static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return true; } -: 99: template static T fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW; -: 100: -: 101: static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() Q_DECL_NOTHROW { return true; } -: 102: static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return true; } -: 103: template static -: 104: T fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) Q_DECL_NOTHROW; -: 105:}; -: 106: -: 107:template struct QAtomicOps : QBasicAtomicOps -: 108:{ -: 109: typedef T Type; -: 110:}; -: 111: -: 112:#if defined(Q_CC_GNU) -: 113: -: 114:template<> struct QAtomicOpsSupport<1> { enum { IsSupported = 1 }; }; -: 115:template<> struct QAtomicOpsSupport<2> { enum { IsSupported = 1 }; }; -: 116:template<> struct QAtomicOpsSupport<8> { enum { IsSupported = 1 }; }; -: 117: -: 118:/* -: 119: * Guide for the inline assembly below: -: 120: * -: 121: * x86 instructions are in the form "{opcode}{length} {source}, {destination}", -: 122: * where the length is one of the letters "b" (byte), "w" (word, 16-bit), "l" -: 123: * (dword, 32-bit), "q" (qword, 64-bit). -: 124: * -: 125: * In most cases, we can omit the length because it's inferred from one of the -: 126: * registers. For example, "xchg %0,%1" doesn't need the length suffix because -: 127: * we can only exchange data of the same size and one of the operands must be a -: 128: * register. -: 129: * -: 130: * The exception is the increment and decrement functions, where we add and -: 131: * subtract an immediate value (1). For those, we need to specify the length. -: 132: * GCC and ICC support the syntax "add%z0 $1, %0", where "%z0" expands to the -: 133: * length of the operand. Unfortunately, clang as of 3.0 doesn't support that. -: 134: * For that reason, the ref() and deref() functions are rolled out for all -: 135: * sizes. -: 136: * -: 137: * The functions are also rolled out for the 1-byte operations since those -: 138: * require a special register constraint "q" to force the compiler to schedule -: 139: * one of the 8-bit registers. It's probably a compiler bug that it tries to -: 140: * use a register that doesn't exist. -: 141: * -: 142: * Finally, 64-bit operations are supported via the cmpxchg8b instruction on -: 143: * 32-bit processors, via specialisation below. -: 144: */ -: 145: -: 146:template<> template inline -: 147:bool QBasicAtomicOps<1>::ref(T &_q_value) Q_DECL_NOTHROW -: 148:{ -: 149: unsigned char ret; -: 150: asm volatile("lock\n" -: 151: "addb $1, %0\n" -: 152: "setne %1" -: 153: : "=m" (_q_value), "=qm" (ret) -: 154: : "m" (_q_value) -: 155: : "memory"); -: 156: return ret != 0; -: 157:} -: 158: -: 159:template<> template inline -: 160:bool QBasicAtomicOps<2>::ref(T &_q_value) Q_DECL_NOTHROW -: 161:{ -: 162: unsigned char ret; -: 163: asm volatile("lock\n" -: 164: "incw %0\n" -: 165: "setne %1" -: 166: : "=m" (_q_value), "=qm" (ret) -: 167: : "m" (_q_value) -: 168: : "memory"); -: 169: return ret != 0; -: 170:} -: 171: -: 172:template<> template inline -: 173:bool QBasicAtomicOps<4>::ref(T &_q_value) Q_DECL_NOTHROW -: 174:{ -: 175: unsigned char ret; -: 176: asm volatile("lock\n" -: 177: "addl $1, %0\n" -: 178: "setne %1" -: 179: : "=m" (_q_value), "=qm" (ret) -: 180: : "m" (_q_value) -: 181: : "memory"); -: 182: return ret != 0; -: 183:} -: 184: -: 185:template<> template inline -: 186:bool QBasicAtomicOps<1>::deref(T &_q_value) Q_DECL_NOTHROW -: 187:{ -: 188: unsigned char ret; -: 189: asm volatile("lock\n" -: 190: "subb $1, %0\n" -: 191: "setne %1" -: 192: : "=m" (_q_value), "=qm" (ret) -: 193: : "m" (_q_value) -: 194: : "memory"); -: 195: return ret != 0; -: 196:} -: 197: -: 198:template<> template inline -: 199:bool QBasicAtomicOps<2>::deref(T &_q_value) Q_DECL_NOTHROW -: 200:{ -: 201: unsigned char ret; -: 202: asm volatile("lock\n" -: 203: "decw %0\n" -: 204: "setne %1" -: 205: : "=m" (_q_value), "=qm" (ret) -: 206: : "m" (_q_value) -: 207: : "memory"); -: 208: return ret != 0; -: 209:} -: 210:template<> template inline function _ZN15QBasicAtomicOpsILi4EE5derefIiEEbRT_ called 94 returned 100% blocks executed 100% 94: 211:bool QBasicAtomicOps<4>::deref(T &_q_value) Q_DECL_NOTHROW -: 212:{ -: 213: unsigned char ret; -: 214: asm volatile("lock\n" -: 215: "subl $1, %0\n" -: 216: "setne %1" -: 217: : "=m" (_q_value), "=qm" (ret) -: 218: : "m" (_q_value) 94: 219: : "memory"); call 0 returned 100% 94: 220: return ret != 0; -: 221:} -: 222: -: 223:template template inline -: 224:bool QBasicAtomicOps::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW -: 225:{ -: 226: unsigned char ret; -: 227: asm volatile("lock\n" -: 228: "cmpxchg %3,%2\n" -: 229: "sete %1\n" -: 230: : "=a" (newValue), "=qm" (ret), "+m" (_q_value) -: 231: : "r" (newValue), "0" (expectedValue) -: 232: : "memory"); -: 233: return ret != 0; -: 234:} -: 235: -: 236:template<> template inline -: 237:bool QBasicAtomicOps<1>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW -: 238:{ -: 239: unsigned char ret; -: 240: asm volatile("lock\n" -: 241: "cmpxchg %3,%2\n" -: 242: "sete %1\n" -: 243: : "=a" (newValue), "=qm" (ret), "+m" (_q_value) -: 244: : "q" (newValue), "0" (expectedValue) -: 245: : "memory"); -: 246: return ret != 0; -: 247:} -: 248: -: 249:template template inline -: 250:bool QBasicAtomicOps::testAndSetRelaxed(T &_q_value, T expectedValue, -: 251: T newValue, T *currentValue) Q_DECL_NOTHROW -: 252:{ -: 253: unsigned char ret; -: 254: asm volatile("lock\n" -: 255: "cmpxchg %3,%2\n" -: 256: "sete %1\n" -: 257: : "=a" (newValue), "=qm" (ret), "+m" (_q_value) -: 258: : "r" (newValue), "0" (expectedValue) -: 259: : "memory"); -: 260: *currentValue = newValue; -: 261: return ret != 0; -: 262:} -: 263: -: 264:template<> template inline -: 265:bool QBasicAtomicOps<1>::testAndSetRelaxed(T &_q_value, T expectedValue, -: 266: T newValue, T *currentValue) Q_DECL_NOTHROW -: 267:{ -: 268: unsigned char ret; -: 269: asm volatile("lock\n" -: 270: "cmpxchg %3,%2\n" -: 271: "sete %1\n" -: 272: : "=a" (newValue), "=qm" (ret), "+m" (_q_value) -: 273: : "q" (newValue), "0" (expectedValue) -: 274: : "memory"); -: 275: *currentValue = newValue; -: 276: return ret != 0; -: 277:} -: 278: -: 279:template template inline -: 280:T QBasicAtomicOps::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW -: 281:{ -: 282: asm volatile("xchg %0,%1" -: 283: : "=r" (newValue), "+m" (_q_value) -: 284: : "0" (newValue) -: 285: : "memory"); -: 286: return newValue; -: 287:} -: 288: -: 289:template<> template inline -: 290:T QBasicAtomicOps<1>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW -: 291:{ -: 292: asm volatile("xchg %0,%1" -: 293: : "=q" (newValue), "+m" (_q_value) -: 294: : "0" (newValue) -: 295: : "memory"); -: 296: return newValue; -: 297:} -: 298: -: 299:template template inline -: 300:T QBasicAtomicOps::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) Q_DECL_NOTHROW -: 301:{ -: 302: T result; -: 303: asm volatile("lock\n" -: 304: "xadd %0,%1" -: 305: : "=r" (result), "+m" (_q_value) -: 306: : "0" (T(valueToAdd * QAtomicAdditiveType::AddScale)) -: 307: : "memory"); -: 308: return result; -: 309:} -: 310: -: 311:template<> template inline -: 312:T QBasicAtomicOps<1>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) Q_DECL_NOTHROW -: 313:{ -: 314: T result; -: 315: asm volatile("lock\n" -: 316: "xadd %0,%1" -: 317: : "=q" (result), "+m" (_q_value) -: 318: : "0" (T(valueToAdd * QAtomicAdditiveType::AddScale)) -: 319: : "memory"); -: 320: return result; -: 321:} -: 322: -: 323:#define Q_ATOMIC_INT8_IS_SUPPORTED -: 324: -: 325:#define Q_ATOMIC_INT8_REFERENCE_COUNTING_IS_ALWAYS_NATIVE -: 326:#define Q_ATOMIC_INT8_REFERENCE_COUNTING_IS_WAIT_FREE -: 327: -: 328:#define Q_ATOMIC_INT8_TEST_AND_SET_IS_ALWAYS_NATIVE -: 329:#define Q_ATOMIC_INT8_TEST_AND_SET_IS_WAIT_FREE -: 330: -: 331:#define Q_ATOMIC_INT8_FETCH_AND_STORE_IS_ALWAYS_NATIVE -: 332:#define Q_ATOMIC_INT8_FETCH_AND_STORE_IS_WAIT_FREE -: 333: -: 334:#define Q_ATOMIC_INT8_FETCH_AND_ADD_IS_ALWAYS_NATIVE -: 335:#define Q_ATOMIC_INT8_FETCH_AND_ADD_IS_WAIT_FREE -: 336: -: 337:#define Q_ATOMIC_INT16_IS_SUPPORTED -: 338: -: 339:#define Q_ATOMIC_INT16_REFERENCE_COUNTING_IS_ALWAYS_NATIVE -: 340:#define Q_ATOMIC_INT16_REFERENCE_COUNTING_IS_WAIT_FREE -: 341: -: 342:#define Q_ATOMIC_INT16_TEST_AND_SET_IS_ALWAYS_NATIVE -: 343:#define Q_ATOMIC_INT16_TEST_AND_SET_IS_WAIT_FREE -: 344: -: 345:#define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_ALWAYS_NATIVE -: 346:#define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_WAIT_FREE -: 347: -: 348:#define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_ALWAYS_NATIVE -: 349:#define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_WAIT_FREE -: 350: -: 351:#ifdef Q_PROCESSOR_X86_64 -: 352: -: 353:#define Q_ATOMIC_INT64_IS_SUPPORTED -: 354: -: 355:#define Q_ATOMIC_INT64_REFERENCE_COUNTING_IS_ALWAYS_NATIVE -: 356:#define Q_ATOMIC_INT64_REFERENCE_COUNTING_IS_WAIT_FREE -: 357: -: 358:#define Q_ATOMIC_INT64_TEST_AND_SET_IS_ALWAYS_NATIVE -: 359:#define Q_ATOMIC_INT64_TEST_AND_SET_IS_WAIT_FREE -: 360: -: 361:#define Q_ATOMIC_INT64_FETCH_AND_STORE_IS_ALWAYS_NATIVE -: 362:#define Q_ATOMIC_INT64_FETCH_AND_STORE_IS_WAIT_FREE -: 363: -: 364:#define Q_ATOMIC_INT64_FETCH_AND_ADD_IS_ALWAYS_NATIVE -: 365:#define Q_ATOMIC_INT64_FETCH_AND_ADD_IS_WAIT_FREE -: 366: -: 367:// native support for 64-bit types -: 368:template<> template inline -: 369:bool QBasicAtomicOps<8>::ref(T &_q_value) Q_DECL_NOTHROW -: 370:{ -: 371: unsigned char ret; -: 372: asm volatile("lock\n" -: 373: "addq $1, %0\n" -: 374: "setne %1" -: 375: : "=m" (_q_value), "=qm" (ret) -: 376: : "m" (_q_value) -: 377: : "memory"); -: 378: return ret != 0; -: 379:} -: 380: -: 381:template<> template inline -: 382:bool QBasicAtomicOps<8>::deref(T &_q_value) Q_DECL_NOTHROW -: 383:{ -: 384: unsigned char ret; -: 385: asm volatile("lock\n" -: 386: "subq $1, %0\n" -: 387: "setne %1" -: 388: : "=m" (_q_value), "=qm" (ret) -: 389: : "m" (_q_value) -: 390: : "memory"); -: 391: return ret != 0; -: 392:} -: 393:#else -: 394:// i386 architecture, emulate 64-bit support via cmpxchg8b -: 395:template <> struct QBasicAtomicOps<8>: QGenericAtomicOps > -: 396:{ -: 397: static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() Q_DECL_NOTHROW { return true; } -: 398: static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return true; } -: 399: template static inline -: 400: bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW -: 401: { -: 402:#ifdef __PIC__ -: 403:# define EBX_reg "r" -: 404:# define EBX_load(reg) "xchg " reg ", %%ebx\n" -: 405:#else -: 406:# define EBX_reg "b" -: 407:# define EBX_load(reg) -: 408:#endif -: 409: quint32 highExpectedValue = quint32(newValue >> 32); // ECX -: 410: asm volatile(EBX_load("%3") -: 411: "lock\n" -: 412: "cmpxchg8b %0\n" -: 413: EBX_load("%3") -: 414: "sete %%cl\n" -: 415: : "+m" (_q_value), "+c" (highExpectedValue), "+&A" (expectedValue) -: 416: : EBX_reg (quint32(newValue & 0xffffffff)) -: 417: : "memory"); -: 418: // if the comparison failed, expectedValue here contains the current value -: 419: return quint8(highExpectedValue) != 0; -: 420:#undef EBX_reg -: 421:#undef EBX_load -: 422: } -: 423:}; -: 424:#endif -: 425: -: 426:#else -: 427:# error "This compiler for x86 is not supported" -: 428:#endif -: 429: -: 430: -: 431:QT_END_NAMESPACE -: 432: -: 433:#endif // QATOMIC_X86_H <<<<<< EOF # path=/home/travis/build/richelbilderbeek/AminoAcidFighter/power.cpp.gcov -: 0:Source:power.cpp -: 0:Programs:19 -: 1:#include "power.h" -: 2: -: 3:#include "game.h" -: 4: function _Z12get_duration5power called 0 returned 0% blocks executed 0% #####: 5:int get_duration(const power any_power) //!OCLINT cannot make this any shorter -: 6:{ #####: 7: switch (any_power) branch 0 never executed branch 1 never executed branch 2 never executed branch 3 never executed branch 4 never executed branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed branch 9 never executed branch 10 never executed branch 11 never executed branch 12 never executed branch 13 never executed branch 14 never executed branch 15 never executed branch 16 never executed branch 17 never executed branch 18 never executed branch 19 never executed branch 20 never executed branch 21 never executed branch 22 never executed branch 23 never executed branch 24 never executed branch 25 never executed branch 26 never executed branch 27 never executed branch 28 never executed -: 8: { #####: 9: case power::ceasefire: return 10; #####: 10: case power::crash: return 10; #####: 11: case power::freeze_all: return 10; #####: 12: case power::freeze_player: return 10; #####: 13: case power::health: return 10; #####: 14: case power::homing_missile: return 10; #####: 15: case power::invisibility: return 10; #####: 16: case power::invisible_bullets: return 10; #####: 17: case power::kamikaze: return 10; #####: 18: case power::maximize: return 10; #####: 19: case power::mine: return 10; #####: 20: case power::minimize: return 10; #####: 21: case power::mix_speed: return 10; #####: 22: case power::multi_shot: return 10; #####: 23: case power::opposite_switch: return 10; #####: 24: case power::power_shot: return 10; #####: 25: case power::repell: return 10; #####: 26: case power::reverse_speed: return 10; #####: 27: case power::reverse_controls: return 10; #####: 28: case power::shield: return 10; #####: 29: case power::slowdown: return 10; #####: 30: case power::spin: return 10; #####: 31: case power::stop_bullets: return 10; #####: 32: case power::strafe_left: return 10; #####: 33: case power::strafe_right: return 10; #####: 34: case power::switch_players: return 10; #####: 35: case power::teleport: return 10; #####: 36: case power::turbo_boost: return 10; -: 37: } -: 38: //Not implemented yet #####: 39: return 0; -: 40:} -: 41: function _Z8do_power5powerR4game called 0 returned 0% blocks executed 0% #####: 42:void do_power(power any_power, game& g) //!OCLINT cannot make this any shorter -: 43:{ #####: 44: switch (any_power) branch 0 never executed branch 1 never executed branch 2 never executed branch 3 never executed branch 4 never executed branch 5 never executed branch 6 never executed branch 7 never executed branch 8 never executed branch 9 never executed branch 10 never executed branch 11 never executed branch 12 never executed branch 13 never executed branch 14 never executed branch 15 never executed branch 16 never executed branch 17 never executed branch 18 never executed branch 19 never executed branch 20 never executed branch 21 never executed branch 22 never executed branch 23 never executed branch 24 never executed branch 25 never executed branch 26 never executed branch 27 never executed branch 28 never executed -: 45: { #####: 46: case power::ceasefire : /*do_ceasefire() */; break; #####: 47: case power::crash : /*do_crash() */; break; #####: 48: case power::freeze_all : /*do_freeze_all() */; break; #####: 49: case power::freeze_player : /*do_freeze_player() */; break; #####: 50: case power::health : /*do_health() */; break; #####: 51: case power::homing_missile : /*do_homing_missle() */; break; #####: 52: case power::invisibility : /*do_invisibility() */; break; #####: 53: case power::invisible_bullets: /*do_invisible_bullets()*/; break; #####: 54: case power::kamikaze : /*do_kamikaze() */ ; break; #####: 55: case power::maximize : /*do_maximize() */ ; break; #####: 56: case power::mine : /*do_mine() */ ; break; #####: 57: case power::minimize : /*do_minimize() */ ; break; #####: 58: case power::mix_speed : /*do_mix_speed() */ ; break; #####: 59: case power::multi_shot : /*do_multi_shot() */ ; break; #####: 60: case power::opposite_switch : /*do_opposite_switch() */ ; break; #####: 61: case power::power_shot : /*do_power_shot() */ ; break; #####: 62: case power::repell : /*do_repell() */ ; break; #####: 63: case power::reverse_speed : /*do_reverse_speed() */ ; break; #####: 64: case power::reverse_controls : /*do_reverse_controls()*/ ; break; #####: 65: case power::shield : /*do_shield() */ ; break; #####: 66: case power::slowdown : /*do_slowdown() */ ; break; #####: 67: case power::spin : /*do_spin() */ ; break; #####: 68: case power::stop_bullets : do_stop_bullets(g) ; break; call 0 never executed call 1 never executed #####: 69: case power::strafe_left : /*do_strafe_left() */ ; break; #####: 70: case power::strafe_right : /*do_strafe_right() */ ; break; #####: 71: case power::switch_players : /*do_switch_players()*/ ; break; #####: 72: case power::teleport : /*do_teleport()*/ ; break; #####: 73: case power::turbo_boost : /*do_turbo_boost()*/ ; break; -: 74: } -: 75: //Not implemented yet #####: 76:} -: 77: -: 78: function _Z15do_stop_bulletsR4game called 5 returned 100% blocks executed 81% 5: 79:void do_stop_bullets(game& g) -: 80:{ -: 81: //No bullets enter here apperantly 10: 82: std::vector bullets = g.get_bullets(); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% branch 4 taken 100% (fallthrough) branch 5 taken 0% (throw) call 6 returned 100% call 7 never executed 10: 83: std::vector new_bullets; call 0 returned 100% call 1 returned 100% call 2 never executed 7: 84: for(int i=0; i < static_cast(bullets.size()); ++i) call 0 returned 100% branch 1 taken 29% (fallthrough) branch 2 taken 71% call 3 returned 100% -: 85: { 2: 86: bullets[i].set_speed_x_zero(); call 0 returned 100% call 1 returned 100% call 2 returned 100% 2: 87: bullets[i].set_speed_y_zero(); call 0 returned 100% call 1 returned 100% call 2 returned 100% 2: 88: new_bullets.push_back(bullets[i]); call 0 returned 100% call 1 returned 100% call 2 returned 100% branch 3 taken 100% (fallthrough) branch 4 taken 0% (throw) -: 89: } 5: 90: g.set_bullets(new_bullets); call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% (throw) call 3 returned 100% call 4 returned 100% branch 5 taken 100% (fallthrough) branch 6 taken 0% (throw) call 7 returned 100% call 8 never executed function _GLOBAL__sub_I_power.cpp called 1 returned 100% blocks executed 100% function _Z41__static_initialization_and_destruction_0ii called 1 returned 100% blocks executed 100% 8: 91:} call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% branch 3 taken 100% (fallthrough) branch 4 taken 0% <<<<<< EOF # path=/home/travis/build/richelbilderbeek/AminoAcidFighter/#usr#include#x86_64-linux-gnu#qt5#QtCore#qarraydata.h.gcov -: 0:Source:/usr/include/x86_64-linux-gnu/qt5/QtCore/qarraydata.h -: 0:Programs:19 -: 1:/**************************************************************************** -: 2:** -: 3:** Copyright (C) 2015 The Qt Company Ltd. -: 4:** Contact: http://www.qt.io/licensing/ -: 5:** -: 6:** This file is part of the QtCore module of the Qt Toolkit. -: 7:** -: 8:** $QT_BEGIN_LICENSE:LGPL21$ -: 9:** Commercial License Usage -: 10:** Licensees holding valid commercial Qt licenses may use this file in -: 11:** accordance with the commercial license agreement provided with the -: 12:** Software or, alternatively, in accordance with the terms contained in -: 13:** a written agreement between you and The Qt Company. For licensing terms -: 14:** and conditions see http://www.qt.io/terms-conditions. For further -: 15:** information use the contact form at http://www.qt.io/contact-us. -: 16:** -: 17:** GNU Lesser General Public License Usage -: 18:** Alternatively, this file may be used under the terms of the GNU Lesser -: 19:** General Public License version 2.1 or version 3 as published by the Free -: 20:** Software Foundation and appearing in the file LICENSE.LGPLv21 and -: 21:** LICENSE.LGPLv3 included in the packaging of this file. Please review the -: 22:** following information to ensure the GNU Lesser General Public License -: 23:** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -: 24:** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -: 25:** -: 26:** As a special exception, The Qt Company gives you certain additional -: 27:** rights. These rights are described in The Qt Company LGPL Exception -: 28:** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -: 29:** -: 30:** $QT_END_LICENSE$ -: 31:** -: 32:****************************************************************************/ -: 33: -: 34:#ifndef QARRAYDATA_H -: 35:#define QARRAYDATA_H -: 36: -: 37:#include -: 38:#include -: 39: -: 40:QT_BEGIN_NAMESPACE -: 41: -: 42:struct Q_CORE_EXPORT QArrayData -: 43:{ -: 44: QtPrivate::RefCount ref; -: 45: int size; -: 46: uint alloc : 31; -: 47: uint capacityReserved : 1; -: 48: -: 49: qptrdiff offset; // in bytes from beginning of header -: 50: -: 51: void *data() -: 52: { -: 53: Q_ASSERT(size == 0 -: 54: || offset < 0 || size_t(offset) >= sizeof(QArrayData)); -: 55: return reinterpret_cast(this) + offset; -: 56: } -: 57: -: 58: const void *data() const -: 59: { -: 60: Q_ASSERT(size == 0 -: 61: || offset < 0 || size_t(offset) >= sizeof(QArrayData)); -: 62: return reinterpret_cast(this) + offset; -: 63: } -: 64: -: 65: // This refers to array data mutability, not "header data" represented by -: 66: // data members in QArrayData. Shared data (array and header) must still -: 67: // follow COW principles. -: 68: bool isMutable() const -: 69: { -: 70: return alloc != 0; -: 71: } -: 72: -: 73: enum AllocationOption { -: 74: CapacityReserved = 0x1, -: 75:#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) -: 76: Unsharable = 0x2, -: 77:#endif -: 78: RawData = 0x4, -: 79: Grow = 0x8, -: 80: -: 81: Default = 0 -: 82: }; -: 83: -: 84: Q_DECLARE_FLAGS(AllocationOptions, AllocationOption) -: 85: -: 86: size_t detachCapacity(size_t newSize) const -: 87: { -: 88: if (capacityReserved && newSize < alloc) -: 89: return alloc; -: 90: return newSize; -: 91: } -: 92: -: 93: AllocationOptions detachFlags() const -: 94: { -: 95: AllocationOptions result; -: 96: if (capacityReserved) -: 97: result |= CapacityReserved; -: 98: return result; -: 99: } -: 100: -: 101: AllocationOptions cloneFlags() const -: 102: { -: 103: AllocationOptions result; -: 104: if (capacityReserved) -: 105: result |= CapacityReserved; -: 106: return result; -: 107: } -: 108: -: 109: static QArrayData *allocate(size_t objectSize, size_t alignment, -: 110: size_t capacity, AllocationOptions options = Default) -: 111: Q_DECL_NOTHROW Q_REQUIRED_RESULT; -: 112: static void deallocate(QArrayData *data, size_t objectSize, -: 113: size_t alignment) Q_DECL_NOTHROW; -: 114: -: 115: static const QArrayData shared_null[2]; -: 116: static QArrayData *sharedNull() Q_DECL_NOTHROW { return const_cast(shared_null); } -: 117:}; -: 118: -: 119:Q_DECLARE_OPERATORS_FOR_FLAGS(QArrayData::AllocationOptions) -: 120: -: 121:template -: 122:struct QTypedArrayData -: 123: : QArrayData -: 124:{ -: 125:#ifdef QT_STRICT_ITERATORS -: 126: class iterator { -: 127: public: -: 128: T *i; -: 129: typedef std::random_access_iterator_tag iterator_category; -: 130: typedef int difference_type; -: 131: typedef T value_type; -: 132: typedef T *pointer; -: 133: typedef T &reference; -: 134: -: 135: inline iterator() : i(0) {} -: 136: inline iterator(T *n) : i(n) {} -: 137: inline iterator(const iterator &o): i(o.i){} // #### Qt 6: remove, the implicit version is fine -: 138: inline T &operator*() const { return *i; } -: 139: inline T *operator->() const { return i; } -: 140: inline T &operator[](int j) const { return *(i + j); } -: 141: inline bool operator==(const iterator &o) const { return i == o.i; } -: 142: inline bool operator!=(const iterator &o) const { return i != o.i; } -: 143: inline bool operator<(const iterator& other) const { return i < other.i; } -: 144: inline bool operator<=(const iterator& other) const { return i <= other.i; } -: 145: inline bool operator>(const iterator& other) const { return i > other.i; } -: 146: inline bool operator>=(const iterator& other) const { return i >= other.i; } -: 147: inline iterator &operator++() { ++i; return *this; } -: 148: inline iterator operator++(int) { T *n = i; ++i; return n; } -: 149: inline iterator &operator--() { i--; return *this; } -: 150: inline iterator operator--(int) { T *n = i; i--; return n; } -: 151: inline iterator &operator+=(int j) { i+=j; return *this; } -: 152: inline iterator &operator-=(int j) { i-=j; return *this; } -: 153: inline iterator operator+(int j) const { return iterator(i+j); } -: 154: inline iterator operator-(int j) const { return iterator(i-j); } -: 155: inline int operator-(iterator j) const { return i - j.i; } -: 156: inline operator T*() const { return i; } -: 157: }; -: 158: friend class iterator; -: 159: -: 160: class const_iterator { -: 161: public: -: 162: const T *i; -: 163: typedef std::random_access_iterator_tag iterator_category; -: 164: typedef int difference_type; -: 165: typedef T value_type; -: 166: typedef const T *pointer; -: 167: typedef const T &reference; -: 168: -: 169: inline const_iterator() : i(0) {} -: 170: inline const_iterator(const T *n) : i(n) {} -: 171: inline const_iterator(const const_iterator &o): i(o.i) {} // #### Qt 6: remove, the default version is fine -: 172: inline explicit const_iterator(const iterator &o): i(o.i) {} -: 173: inline const T &operator*() const { return *i; } -: 174: inline const T *operator->() const { return i; } -: 175: inline const T &operator[](int j) const { return *(i + j); } -: 176: inline bool operator==(const const_iterator &o) const { return i == o.i; } -: 177: inline bool operator!=(const const_iterator &o) const { return i != o.i; } -: 178: inline bool operator<(const const_iterator& other) const { return i < other.i; } -: 179: inline bool operator<=(const const_iterator& other) const { return i <= other.i; } -: 180: inline bool operator>(const const_iterator& other) const { return i > other.i; } -: 181: inline bool operator>=(const const_iterator& other) const { return i >= other.i; } -: 182: inline const_iterator &operator++() { ++i; return *this; } -: 183: inline const_iterator operator++(int) { const T *n = i; ++i; return n; } -: 184: inline const_iterator &operator--() { i--; return *this; } -: 185: inline const_iterator operator--(int) { const T *n = i; i--; return n; } -: 186: inline const_iterator &operator+=(int j) { i+=j; return *this; } -: 187: inline const_iterator &operator-=(int j) { i-=j; return *this; } -: 188: inline const_iterator operator+(int j) const { return const_iterator(i+j); } -: 189: inline const_iterator operator-(int j) const { return const_iterator(i-j); } -: 190: inline int operator-(const_iterator j) const { return i - j.i; } -: 191: inline operator const T*() const { return i; } -: 192: }; -: 193: friend class const_iterator; -: 194:#else -: 195: typedef T* iterator; -: 196: typedef const T* const_iterator; -: 197:#endif -: 198: -: 199: T *data() { return static_cast(QArrayData::data()); } -: 200: const T *data() const { return static_cast(QArrayData::data()); } -: 201: -: 202: iterator begin(iterator = iterator()) { return data(); } -: 203: iterator end(iterator = iterator()) { return data() + size; } -: 204: const_iterator begin(const_iterator = const_iterator()) const { return data(); } -: 205: const_iterator end(const_iterator = const_iterator()) const { return data() + size; } -: 206: const_iterator constBegin(const_iterator = const_iterator()) const { return data(); } -: 207: const_iterator constEnd(const_iterator = const_iterator()) const { return data() + size; } -: 208: -: 209: class AlignmentDummy { QArrayData header; T data; }; -: 210: -: 211: static QTypedArrayData *allocate(size_t capacity, -: 212: AllocationOptions options = Default) Q_REQUIRED_RESULT -: 213: { -: 214: Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData)); -: 215: return static_cast(QArrayData::allocate(sizeof(T), -: 216: Q_ALIGNOF(AlignmentDummy), capacity, options)); -: 217: } -: 218: function _ZN15QTypedArrayDataItE10deallocateEP10QArrayData called 70 returned 100% blocks executed 100% 70: 219: static void deallocate(QArrayData *data) -: 220: { -: 221: Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData)); 70: 222: QArrayData::deallocate(data, sizeof(T), Q_ALIGNOF(AlignmentDummy)); call 0 returned 100% 70: 223: } -: 224: -: 225: static QTypedArrayData *fromRawData(const T *data, size_t n, -: 226: AllocationOptions options = Default) -: 227: { -: 228: Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData)); -: 229: QTypedArrayData *result = allocate(0, options | RawData); -: 230: if (result) { -: 231: Q_ASSERT(!result->ref.isShared()); // No shared empty, please! -: 232: -: 233: result->offset = reinterpret_cast(data) -: 234: - reinterpret_cast(result); -: 235: result->size = int(n); -: 236: } -: 237: return result; -: 238: } -: 239: -: 240: static QTypedArrayData *sharedNull() Q_DECL_NOTHROW -: 241: { -: 242: Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData)); -: 243: return static_cast(QArrayData::sharedNull()); -: 244: } -: 245: -: 246: static QTypedArrayData *sharedEmpty() -: 247: { -: 248: Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData)); -: 249: return allocate(/* capacity */ 0); -: 250: } -: 251: -: 252: static QTypedArrayData *unsharableEmpty() -: 253: { -: 254: Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData)); -: 255: return allocate(/* capacity */ 0, Unsharable); -: 256: } -: 257:}; -: 258: -: 259:template -: 260:struct QStaticArrayData -: 261:{ -: 262: QArrayData header; -: 263: T data[N]; -: 264:}; -: 265: -: 266:// Support for returning QArrayDataPointer from functions -: 267:template -: 268:struct QArrayDataPointerRef -: 269:{ -: 270: QTypedArrayData *ptr; -: 271:}; -: 272: -: 273:#define Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(size, offset) \ -: 274: { Q_REFCOUNT_INITIALIZE_STATIC, size, 0, 0, offset } \ -: 275: /**/ -: 276: -: 277:#define Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER(type, size) \ -: 278: Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(size,\ -: 279: ((sizeof(QArrayData) + (Q_ALIGNOF(type) - 1)) & ~(Q_ALIGNOF(type) - 1) )) \ -: 280: /**/ -: 281: -: 282://////////////////////////////////////////////////////////////////////////////// -: 283:// Q_ARRAY_LITERAL -: 284: -: 285:// The idea here is to place a (read-only) copy of header and array data in an -: 286:// mmappable portion of the executable (typically, .rodata section). This is -: 287:// accomplished by hiding a static const instance of QStaticArrayData, which is -: 288:// POD. -: 289: -: 290:#if defined(Q_COMPILER_VARIADIC_MACROS) -: 291:#if defined(Q_COMPILER_LAMBDA) -: 292:// Hide array inside a lambda -: 293:#define Q_ARRAY_LITERAL(Type, ...) \ -: 294: ([]() -> QArrayDataPointerRef { \ -: 295: /* MSVC 2010 Doesn't support static variables in a lambda, but */ \ -: 296: /* happily accepts them in a static function of a lambda-local */ \ -: 297: /* struct :-) */ \ -: 298: struct StaticWrapper { \ -: 299: static QArrayDataPointerRef get() \ -: 300: { \ -: 301: Q_ARRAY_LITERAL_IMPL(Type, __VA_ARGS__) \ -: 302: return ref; \ -: 303: } \ -: 304: }; \ -: 305: return StaticWrapper::get(); \ -: 306: }()) \ -: 307: /**/ -: 308:#endif -: 309:#endif // defined(Q_COMPILER_VARIADIC_MACROS) -: 310: -: 311:#if defined(Q_ARRAY_LITERAL) -: 312:#define Q_ARRAY_LITERAL_IMPL(Type, ...) \ -: 313: union { Type type_must_be_POD; } dummy; Q_UNUSED(dummy) \ -: 314: \ -: 315: /* Portable compile-time array size computation */ \ -: 316: Type data[] = { __VA_ARGS__ }; Q_UNUSED(data) \ -: 317: enum { Size = sizeof(data) / sizeof(data[0]) }; \ -: 318: \ -: 319: static const QStaticArrayData literal = { \ -: 320: Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER(Type, Size), { __VA_ARGS__ } }; \ -: 321: \ -: 322: QArrayDataPointerRef ref = \ -: 323: { static_cast *>( \ -: 324: const_cast(&literal.header)) }; \ -: 325: /**/ -: 326:#else -: 327:// As a fallback, memory is allocated and data copied to the heap. -: 328: -: 329:// The fallback macro does NOT use variadic macros and does NOT support -: 330:// variable number of arguments. It is suitable for char arrays. -: 331: -: 332:namespace QtPrivate { -: 333: template -: 334: inline QArrayDataPointerRef qMakeArrayLiteral(const T (&array)[N]) -: 335: { -: 336: union { T type_must_be_POD; } dummy; Q_UNUSED(dummy) -: 337: -: 338: QArrayDataPointerRef result = { QTypedArrayData::allocate(N) }; -: 339: Q_CHECK_PTR(result.ptr); -: 340: -: 341: ::memcpy(result.ptr->data(), array, N * sizeof(T)); -: 342: result.ptr->size = N; -: 343: -: 344: return result; -: 345: } -: 346:} -: 347: -: 348:#define Q_ARRAY_LITERAL(Type, Array) \ -: 349: QT_PREPEND_NAMESPACE(QtPrivate::qMakeArrayLiteral)( Array ) -: 350:#endif // !defined(Q_ARRAY_LITERAL) -: 351: -: 352:namespace QtPrivate { -: 353:struct Q_CORE_EXPORT QContainerImplHelper -: 354:{ -: 355: enum CutResult { Null, Empty, Full, Subset }; -: 356: static CutResult mid(int originalLength, int *position, int *length); -: 357:}; -: 358:} -: 359: -: 360:QT_END_NAMESPACE -: 361: -: 362:#endif // include guard <<<<<< EOF # path=/home/travis/build/richelbilderbeek/AminoAcidFighter/#usr#include#c++#5#bits#basic_string.h.gcov -: 0:Source:/usr/include/c++/5/bits/basic_string.h -: 0:Programs:19 -: 1:// Components for manipulating sequences of characters -*- C++ -*- -: 2: -: 3:// Copyright (C) 1997-2015 Free Software Foundation, Inc. -: 4:// -: 5:// This file is part of the GNU ISO C++ Library. This library is free -: 6:// software; you can redistribute it and/or modify it under the -: 7:// terms of the GNU General Public License as published by the -: 8:// Free Software Foundation; either version 3, or (at your option) -: 9:// any later version. -: 10: -: 11:// This library is distributed in the hope that it will be useful, -: 12:// but WITHOUT ANY WARRANTY; without even the implied warranty of -: 13:// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -: 14:// GNU General Public License for more details. -: 15: -: 16:// Under Section 7 of GPL version 3, you are granted additional -: 17:// permissions described in the GCC Runtime Library Exception, version -: 18:// 3.1, as published by the Free Software Foundation. -: 19: -: 20:// You should have received a copy of the GNU General Public License and -: 21:// a copy of the GCC Runtime Library Exception along with this program; -: 22:// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -: 23:// . -: 24: -: 25:/** @file bits/basic_string.h -: 26: * This is an internal header file, included by other library headers. -: 27: * Do not attempt to use it directly. @headername{string} -: 28: */ -: 29: -: 30:// -: 31:// ISO C++ 14882: 21 Strings library -: 32:// -: 33: -: 34:#ifndef _BASIC_STRING_H -: 35:#define _BASIC_STRING_H 1 -: 36: -: 37:#pragma GCC system_header -: 38: -: 39:#include -: 40:#include -: 41:#include -: 42:#if __cplusplus >= 201103L -: 43:#include -: 44:#endif -: 45: -: 46:namespace std _GLIBCXX_VISIBILITY(default) -: 47:{ -: 48:_GLIBCXX_BEGIN_NAMESPACE_VERSION -: 49: -: 50:#if _GLIBCXX_USE_CXX11_ABI -: 51:_GLIBCXX_BEGIN_NAMESPACE_CXX11 -: 52: /** -: 53: * @class basic_string basic_string.h -: 54: * @brief Managing sequences of characters and character-like objects. -: 55: * -: 56: * @ingroup strings -: 57: * @ingroup sequences -: 58: * -: 59: * @tparam _CharT Type of character -: 60: * @tparam _Traits Traits for character type, defaults to -: 61: * char_traits<_CharT>. -: 62: * @tparam _Alloc Allocator type, defaults to allocator<_CharT>. -: 63: * -: 64: * Meets the requirements of a container, a -: 65: * reversible container, and a -: 66: * sequence. Of the -: 67: * optional sequence requirements, only -: 68: * @c push_back, @c at, and @c %array access are supported. -: 69: */ -: 70: template -: 71: class basic_string -: 72: { -: 73: typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template -: 74: rebind<_CharT>::other _Char_alloc_type; -: 75: typedef __gnu_cxx::__alloc_traits<_Char_alloc_type> _Alloc_traits; -: 76: -: 77: // Types: -: 78: public: -: 79: typedef _Traits traits_type; -: 80: typedef typename _Traits::char_type value_type; -: 81: typedef _Char_alloc_type allocator_type; -: 82: typedef typename _Alloc_traits::size_type size_type; -: 83: typedef typename _Alloc_traits::difference_type difference_type; -: 84: typedef typename _Alloc_traits::reference reference; -: 85: typedef typename _Alloc_traits::const_reference const_reference; -: 86: typedef typename _Alloc_traits::pointer pointer; -: 87: typedef typename _Alloc_traits::const_pointer const_pointer; -: 88: typedef __gnu_cxx::__normal_iterator iterator; -: 89: typedef __gnu_cxx::__normal_iterator -: 90: const_iterator; -: 91: typedef std::reverse_iterator const_reverse_iterator; -: 92: typedef std::reverse_iterator reverse_iterator; -: 93: -: 94: /// Value returned by various member functions when they fail. -: 95: static const size_type npos = static_cast(-1); -: 96: -: 97: private: -: 98: // type used for positions in insert, erase etc. -: 99:#if __cplusplus < 201103L -: 100: typedef iterator __const_iterator; -: 101:#else -: 102: typedef const_iterator __const_iterator; -: 103:#endif -: 104: -: 105: // Use empty-base optimization: http://www.cantrip.org/emptyopt.html -: 106: struct _Alloc_hider : allocator_type // TODO check __is_final -: 107: { -: 108: _Alloc_hider(pointer __dat, const _Alloc& __a = _Alloc()) -: 109: : allocator_type(__a), _M_p(__dat) { } -: 110: -: 111: pointer _M_p; // The actual data. -: 112: }; -: 113: -: 114: _Alloc_hider _M_dataplus; -: 115: size_type _M_string_length; -: 116: -: 117: enum { _S_local_capacity = 15 / sizeof(_CharT) }; -: 118: -: 119: union -: 120: { -: 121: _CharT _M_local_buf[_S_local_capacity + 1]; -: 122: size_type _M_allocated_capacity; -: 123: }; -: 124: -: 125: void -: 126: _M_data(pointer __p) -: 127: { _M_dataplus._M_p = __p; } -: 128: -: 129: void -: 130: _M_length(size_type __length) -: 131: { _M_string_length = __length; } -: 132: -: 133: pointer -: 134: _M_data() const -: 135: { return _M_dataplus._M_p; } -: 136: -: 137: pointer -: 138: _M_local_data() -: 139: { -: 140:#if __cplusplus >= 201103L -: 141: return std::pointer_traits::pointer_to(*_M_local_buf); -: 142:#else -: 143: return pointer(_M_local_buf); -: 144:#endif -: 145: } -: 146: -: 147: const_pointer -: 148: _M_local_data() const -: 149: { -: 150:#if __cplusplus >= 201103L -: 151: return std::pointer_traits::pointer_to(*_M_local_buf); -: 152:#else -: 153: return const_pointer(_M_local_buf); -: 154:#endif -: 155: } -: 156: -: 157: void -: 158: _M_capacity(size_type __capacity) -: 159: { _M_allocated_capacity = __capacity; } -: 160: -: 161: void -: 162: _M_set_length(size_type __n) -: 163: { -: 164: _M_length(__n); -: 165: traits_type::assign(_M_data()[__n], _CharT()); -: 166: } -: 167: -: 168: bool -: 169: _M_is_local() const -: 170: { return _M_data() == _M_local_data(); } -: 171: -: 172: // Create & Destroy -: 173: pointer -: 174: _M_create(size_type&, size_type); -: 175: -: 176: void -: 177: _M_dispose() -: 178: { -: 179: if (!_M_is_local()) -: 180: _M_destroy(_M_allocated_capacity); -: 181: } -: 182: -: 183: void -: 184: _M_destroy(size_type __size) throw() -: 185: { _Alloc_traits::deallocate(_M_get_allocator(), _M_data(), __size + 1); } -: 186: -: 187: // _M_construct_aux is used to implement the 21.3.1 para 15 which -: 188: // requires special behaviour if _InIterator is an integral type -: 189: template -: 190: void -: 191: _M_construct_aux(_InIterator __beg, _InIterator __end, -: 192: std::__false_type) -: 193: { -: 194: typedef typename iterator_traits<_InIterator>::iterator_category _Tag; -: 195: _M_construct(__beg, __end, _Tag()); -: 196: } -: 197: -: 198: // _GLIBCXX_RESOLVE_LIB_DEFECTS -: 199: // 438. Ambiguity in the "do the right thing" clause -: 200: template -: 201: void -: 202: _M_construct_aux(_Integer __beg, _Integer __end, std::__true_type) -: 203: { _M_construct_aux_2(static_cast(__beg), __end); } -: 204: -: 205: void -: 206: _M_construct_aux_2(size_type __req, _CharT __c) -: 207: { _M_construct(__req, __c); } -: 208: -: 209: template -: 210: void -: 211: _M_construct(_InIterator __beg, _InIterator __end) -: 212: { -: 213: typedef typename std::__is_integer<_InIterator>::__type _Integral; -: 214: _M_construct_aux(__beg, __end, _Integral()); -: 215: } -: 216: -: 217: // For Input Iterators, used in istreambuf_iterators, etc. -: 218: template -: 219: void -: 220: _M_construct(_InIterator __beg, _InIterator __end, -: 221: std::input_iterator_tag); -: 222: -: 223: // For forward_iterators up to random_access_iterators, used for -: 224: // string::iterator, _CharT*, etc. -: 225: template -: 226: void -: 227: _M_construct(_FwdIterator __beg, _FwdIterator __end, -: 228: std::forward_iterator_tag); -: 229: -: 230: void -: 231: _M_construct(size_type __req, _CharT __c); -: 232: -: 233: allocator_type& -: 234: _M_get_allocator() -: 235: { return _M_dataplus; } -: 236: -: 237: const allocator_type& -: 238: _M_get_allocator() const -: 239: { return _M_dataplus; } -: 240: -: 241: private: -: 242: -: 243:#ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST -: 244: // The explicit instantiations in misc-inst.cc require this due to -: 245: // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64063 -: 246: template::__value -: 248: && !__are_same<_Tp, const _CharT*>::__value -: 249: && !__are_same<_Tp, iterator>::__value -: 250: && !__are_same<_Tp, const_iterator>::__value> -: 251: struct __enable_if_not_native_iterator -: 252: { typedef basic_string& __type; }; -: 253: template -: 254: struct __enable_if_not_native_iterator<_Tp, false> { }; -: 255:#endif -: 256: -: 257: size_type -: 258: _M_check(size_type __pos, const char* __s) const -: 259: { -: 260: if (__pos > this->size()) -: 261: __throw_out_of_range_fmt(__N("%s: __pos (which is %zu) > " -: 262: "this->size() (which is %zu)"), -: 263: __s, __pos, this->size()); -: 264: return __pos; -: 265: } -: 266: -: 267: void -: 268: _M_check_length(size_type __n1, size_type __n2, const char* __s) const -: 269: { -: 270: if (this->max_size() - (this->size() - __n1) < __n2) -: 271: __throw_length_error(__N(__s)); -: 272: } -: 273: -: 274: -: 275: // NB: _M_limit doesn't check for a bad __pos value. -: 276: size_type -: 277: _M_limit(size_type __pos, size_type __off) const _GLIBCXX_NOEXCEPT -: 278: { -: 279: const bool __testoff = __off < this->size() - __pos; -: 280: return __testoff ? __off : this->size() - __pos; -: 281: } -: 282: -: 283: // True if _Rep and source do not overlap. -: 284: bool -: 285: _M_disjunct(const _CharT* __s) const _GLIBCXX_NOEXCEPT -: 286: { -: 287: return (less()(__s, _M_data()) -: 288: || less()(_M_data() + this->size(), __s)); -: 289: } -: 290: -: 291: // When __n = 1 way faster than the general multichar -: 292: // traits_type::copy/move/assign. -: 293: static void -: 294: _S_copy(_CharT* __d, const _CharT* __s, size_type __n) -: 295: { -: 296: if (__n == 1) -: 297: traits_type::assign(*__d, *__s); -: 298: else -: 299: traits_type::copy(__d, __s, __n); -: 300: } -: 301: -: 302: static void -: 303: _S_move(_CharT* __d, const _CharT* __s, size_type __n) -: 304: { -: 305: if (__n == 1) -: 306: traits_type::assign(*__d, *__s); -: 307: else -: 308: traits_type::move(__d, __s, __n); -: 309: } -: 310: -: 311: static void -: 312: _S_assign(_CharT* __d, size_type __n, _CharT __c) -: 313: { -: 314: if (__n == 1) -: 315: traits_type::assign(*__d, __c); -: 316: else -: 317: traits_type::assign(__d, __n, __c); -: 318: } -: 319: -: 320: // _S_copy_chars is a separate template to permit specialization -: 321: // to optimize for the common case of pointers as iterators. -: 322: template -: 323: static void -: 324: _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2) -: 325: { -: 326: for (; __k1 != __k2; ++__k1, ++__p) -: 327: traits_type::assign(*__p, *__k1); // These types are off. -: 328: } -: 329: -: 330: static void -: 331: _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) _GLIBCXX_NOEXCEPT -: 332: { _S_copy_chars(__p, __k1.base(), __k2.base()); } -: 333: -: 334: static void -: 335: _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2) -: 336: _GLIBCXX_NOEXCEPT -: 337: { _S_copy_chars(__p, __k1.base(), __k2.base()); } -: 338: -: 339: static void -: 340: _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) _GLIBCXX_NOEXCEPT -: 341: { _S_copy(__p, __k1, __k2 - __k1); } -: 342: -: 343: static void -: 344: _S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2) -: 345: _GLIBCXX_NOEXCEPT -: 346: { _S_copy(__p, __k1, __k2 - __k1); } -: 347: -: 348: static int -: 349: _S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT -: 350: { -: 351: const difference_type __d = difference_type(__n1 - __n2); -: 352: -: 353: if (__d > __gnu_cxx::__numeric_traits::__max) -: 354: return __gnu_cxx::__numeric_traits::__max; -: 355: else if (__d < __gnu_cxx::__numeric_traits::__min) -: 356: return __gnu_cxx::__numeric_traits::__min; -: 357: else -: 358: return int(__d); -: 359: } -: 360: -: 361: void -: 362: _M_assign(const basic_string& __rcs); -: 363: -: 364: void -: 365: _M_mutate(size_type __pos, size_type __len1, const _CharT* __s, -: 366: size_type __len2); -: 367: -: 368: void -: 369: _M_erase(size_type __pos, size_type __n); -: 370: -: 371: public: -: 372: // Construct/copy/destroy: -: 373: // NB: We overload ctors in some cases instead of using default -: 374: // arguments, per 17.4.4.4 para. 2 item 2. -: 375: -: 376: /** -: 377: * @brief Default constructor creates an empty string. -: 378: */ -: 379: basic_string() -: 380:#if __cplusplus >= 201103L -: 381: noexcept(is_nothrow_default_constructible<_Alloc>::value) -: 382:#endif -: 383: : _M_dataplus(_M_local_data()) -: 384: { _M_set_length(0); } -: 385: -: 386: /** -: 387: * @brief Construct an empty string using allocator @a a. -: 388: */ -: 389: explicit -: 390: basic_string(const _Alloc& __a) -: 391: : _M_dataplus(_M_local_data(), __a) -: 392: { _M_set_length(0); } -: 393: -: 394: /** -: 395: * @brief Construct string with copy of value of @a __str. -: 396: * @param __str Source string. -: 397: */ -: 398: basic_string(const basic_string& __str) -: 399: : _M_dataplus(_M_local_data(), __str._M_get_allocator()) // TODO A traits -: 400: { _M_construct(__str._M_data(), __str._M_data() + __str.length()); } -: 401: -: 402: /** -: 403: * @brief Construct string as copy of a substring. -: 404: * @param __str Source string. -: 405: * @param __pos Index of first character to copy from. -: 406: * @param __n Number of characters to copy (default remainder). -: 407: */ -: 408: // _GLIBCXX_RESOLVE_LIB_DEFECTS -: 409: // 2402. [this constructor] shouldn't use Allocator() -: 410: basic_string(const basic_string& __str, size_type __pos, -: 411: size_type __n = npos) -: 412: : _M_dataplus(_M_local_data()) -: 413: { -: 414: const _CharT* __start = __str._M_data() -: 415: + __str._M_check(__pos, "basic_string::basic_string"); -: 416: _M_construct(__start, __start + __str._M_limit(__pos, __n)); -: 417: } -: 418: -: 419: /** -: 420: * @brief Construct string as copy of a substring. -: 421: * @param __str Source string. -: 422: * @param __pos Index of first character to copy from. -: 423: * @param __n Number of characters to copy (default remainder). -: 424: * @param __a Allocator to use. -: 425: */ -: 426: basic_string(const basic_string& __str, size_type __pos, -: 427: size_type __n, const _Alloc& __a) -: 428: : _M_dataplus(_M_local_data(), __a) -: 429: { -: 430: const _CharT* __start -: 431: = __str._M_data() + __str._M_check(__pos, "string::string"); -: 432: _M_construct(__start, __start + __str._M_limit(__pos, __n)); -: 433: } -: 434: -: 435: /** -: 436: * @brief Construct string initialized by a character %array. -: 437: * @param __s Source character %array. -: 438: * @param __n Number of characters to copy. -: 439: * @param __a Allocator to use (default is default allocator). -: 440: * -: 441: * NB: @a __s must have at least @a __n characters, '\\0' -: 442: * has no special meaning. -: 443: */ -: 444: basic_string(const _CharT* __s, size_type __n, -: 445: const _Alloc& __a = _Alloc()) -: 446: : _M_dataplus(_M_local_data(), __a) -: 447: { _M_construct(__s, __s + __n); } -: 448: -: 449: /** -: 450: * @brief Construct string as copy of a C string. -: 451: * @param __s Source C string. -: 452: * @param __a Allocator to use (default is default allocator). -: 453: */ -: 454: basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()) -: 455: : _M_dataplus(_M_local_data(), __a) -: 456: { _M_construct(__s, __s ? __s + traits_type::length(__s) : __s+npos); } -: 457: -: 458: /** -: 459: * @brief Construct string as multiple characters. -: 460: * @param __n Number of characters. -: 461: * @param __c Character to use. -: 462: * @param __a Allocator to use (default is default allocator). -: 463: */ -: 464: basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()) -: 465: : _M_dataplus(_M_local_data(), __a) -: 466: { _M_construct(__n, __c); } -: 467: -: 468:#if __cplusplus >= 201103L -: 469: /** -: 470: * @brief Move construct string. -: 471: * @param __str Source string. -: 472: * -: 473: * The newly-created string contains the exact contents of @a __str. -: 474: * @a __str is a valid, but unspecified string. -: 475: **/ -: 476: basic_string(basic_string&& __str) noexcept -: 477: : _M_dataplus(_M_local_data(), std::move(__str._M_get_allocator())) -: 478: { -: 479: if (__str._M_is_local()) -: 480: { -: 481: traits_type::copy(_M_local_buf, __str._M_local_buf, -: 482: _S_local_capacity + 1); -: 483: } -: 484: else -: 485: { -: 486: _M_data(__str._M_data()); -: 487: _M_capacity(__str._M_allocated_capacity); -: 488: } -: 489: -: 490: // Must use _M_length() here not _M_set_length() because -: 491: // basic_stringbuf relies on writing into unallocated capacity so -: 492: // we mess up the contents if we put a '\0' in the string. -: 493: _M_length(__str.length()); -: 494: __str._M_data(__str._M_local_data()); -: 495: __str._M_set_length(0); -: 496: } -: 497: -: 498: /** -: 499: * @brief Construct string from an initializer %list. -: 500: * @param __l std::initializer_list of characters. -: 501: * @param __a Allocator to use (default is default allocator). -: 502: */ -: 503: basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) -: 504: : _M_dataplus(_M_local_data(), __a) -: 505: { _M_construct(__l.begin(), __l.end()); } -: 506: -: 507: basic_string(const basic_string& __str, const _Alloc& __a) -: 508: : _M_dataplus(_M_local_data(), __a) -: 509: { _M_construct(__str.begin(), __str.end()); } -: 510: -: 511: basic_string(basic_string&& __str, const _Alloc& __a) -: 512: : _M_dataplus(_M_local_data(), __a) -: 513: { -: 514: if (__str.get_allocator() == __a) -: 515: *this = std::move(__str); -: 516: else -: 517: _M_construct(__str.begin(), __str.end()); -: 518: } -: 519: -: 520:#endif // C++11 -: 521: -: 522: /** -: 523: * @brief Construct string as copy of a range. -: 524: * @param __beg Start of range. -: 525: * @param __end End of range. -: 526: * @param __a Allocator to use (default is default allocator). -: 527: */ -: 528:#if __cplusplus >= 201103L -: 529: template> -: 531:#else -: 532: template -: 533:#endif -: 534: basic_string(_InputIterator __beg, _InputIterator __end, -: 535: const _Alloc& __a = _Alloc()) -: 536: : _M_dataplus(_M_local_data(), __a) -: 537: { _M_construct(__beg, __end); } -: 538: -: 539: /** -: 540: * @brief Destroy the string instance. -: 541: */ -: 542: ~basic_string() -: 543: { _M_dispose(); } -: 544: -: 545: /** -: 546: * @brief Assign the value of @a str to this string. -: 547: * @param __str Source string. -: 548: */ -: 549: basic_string& -: 550: operator=(const basic_string& __str) -: 551: { return this->assign(__str); } -: 552: -: 553: /** -: 554: * @brief Copy contents of @a s into this string. -: 555: * @param __s Source null-terminated string. -: 556: */ -: 557: basic_string& -: 558: operator=(const _CharT* __s) -: 559: { return this->assign(__s); } -: 560: -: 561: /** -: 562: * @brief Set value to string of length 1. -: 563: * @param __c Source character. -: 564: * -: 565: * Assigning to a character makes this string length 1 and -: 566: * (*this)[0] == @a c. -: 567: */ -: 568: basic_string& -: 569: operator=(_CharT __c) -: 570: { -: 571: this->assign(1, __c); -: 572: return *this; -: 573: } -: 574: -: 575:#if __cplusplus >= 201103L -: 576: /** -: 577: * @brief Move assign the value of @a str to this string. -: 578: * @param __str Source string. -: 579: * -: 580: * The contents of @a str are moved into this string (without copying). -: 581: * @a str is a valid, but unspecified string. -: 582: **/ -: 583: // PR 58265, this should be noexcept. -: 584: // _GLIBCXX_RESOLVE_LIB_DEFECTS -: 585: // 2063. Contradictory requirements for string move assignment -: 586: basic_string& -: 587: operator=(basic_string&& __str) -: 588: { -: 589: this->swap(__str); -: 590: return *this; -: 591: } -: 592: -: 593: /** -: 594: * @brief Set value to string constructed from initializer %list. -: 595: * @param __l std::initializer_list. -: 596: */ -: 597: basic_string& -: 598: operator=(initializer_list<_CharT> __l) -: 599: { -: 600: this->assign(__l.begin(), __l.size()); -: 601: return *this; -: 602: } -: 603:#endif // C++11 -: 604: -: 605: // Iterators: -: 606: /** -: 607: * Returns a read/write iterator that points to the first character in -: 608: * the %string. -: 609: */ -: 610: iterator -: 611: begin() _GLIBCXX_NOEXCEPT -: 612: { return iterator(_M_data()); } -: 613: -: 614: /** -: 615: * Returns a read-only (constant) iterator that points to the first -: 616: * character in the %string. -: 617: */ -: 618: const_iterator -: 619: begin() const _GLIBCXX_NOEXCEPT -: 620: { return const_iterator(_M_data()); } -: 621: -: 622: /** -: 623: * Returns a read/write iterator that points one past the last -: 624: * character in the %string. -: 625: */ -: 626: iterator -: 627: end() _GLIBCXX_NOEXCEPT -: 628: { return iterator(_M_data() + this->size()); } -: 629: -: 630: /** -: 631: * Returns a read-only (constant) iterator that points one past the -: 632: * last character in the %string. -: 633: */ -: 634: const_iterator -: 635: end() const _GLIBCXX_NOEXCEPT -: 636: { return const_iterator(_M_data() + this->size()); } -: 637: -: 638: /** -: 639: * Returns a read/write reverse iterator that points to the last -: 640: * character in the %string. Iteration is done in reverse element -: 641: * order. -: 642: */ -: 643: reverse_iterator -: 644: rbegin() _GLIBCXX_NOEXCEPT -: 645: { return reverse_iterator(this->end()); } -: 646: -: 647: /** -: 648: * Returns a read-only (constant) reverse iterator that points -: 649: * to the last character in the %string. Iteration is done in -: 650: * reverse element order. -: 651: */ -: 652: const_reverse_iterator -: 653: rbegin() const _GLIBCXX_NOEXCEPT -: 654: { return const_reverse_iterator(this->end()); } -: 655: -: 656: /** -: 657: * Returns a read/write reverse iterator that points to one before the -: 658: * first character in the %string. Iteration is done in reverse -: 659: * element order. -: 660: */ -: 661: reverse_iterator -: 662: rend() _GLIBCXX_NOEXCEPT -: 663: { return reverse_iterator(this->begin()); } -: 664: -: 665: /** -: 666: * Returns a read-only (constant) reverse iterator that points -: 667: * to one before the first character in the %string. Iteration -: 668: * is done in reverse element order. -: 669: */ -: 670: const_reverse_iterator -: 671: rend() const _GLIBCXX_NOEXCEPT -: 672: { return const_reverse_iterator(this->begin()); } -: 673: -: 674:#if __cplusplus >= 201103L -: 675: /** -: 676: * Returns a read-only (constant) iterator that points to the first -: 677: * character in the %string. -: 678: */ -: 679: const_iterator -: 680: cbegin() const noexcept -: 681: { return const_iterator(this->_M_data()); } -: 682: -: 683: /** -: 684: * Returns a read-only (constant) iterator that points one past the -: 685: * last character in the %string. -: 686: */ -: 687: const_iterator -: 688: cend() const noexcept -: 689: { return const_iterator(this->_M_data() + this->size()); } -: 690: -: 691: /** -: 692: * Returns a read-only (constant) reverse iterator that points -: 693: * to the last character in the %string. Iteration is done in -: 694: * reverse element order. -: 695: */ -: 696: const_reverse_iterator -: 697: crbegin() const noexcept -: 698: { return const_reverse_iterator(this->end()); } -: 699: -: 700: /** -: 701: * Returns a read-only (constant) reverse iterator that points -: 702: * to one before the first character in the %string. Iteration -: 703: * is done in reverse element order. -: 704: */ -: 705: const_reverse_iterator -: 706: crend() const noexcept -: 707: { return const_reverse_iterator(this->begin()); } -: 708:#endif -: 709: -: 710: public: -: 711: // Capacity: -: 712: /// Returns the number of characters in the string, not including any -: 713: /// null-termination. -: 714: size_type -: 715: size() const _GLIBCXX_NOEXCEPT -: 716: { return _M_string_length; } -: 717: -: 718: /// Returns the number of characters in the string, not including any -: 719: /// null-termination. -: 720: size_type -: 721: length() const _GLIBCXX_NOEXCEPT -: 722: { return _M_string_length; } -: 723: -: 724: /// Returns the size() of the largest possible %string. -: 725: size_type -: 726: max_size() const _GLIBCXX_NOEXCEPT -: 727: { return (_Alloc_traits::max_size(_M_get_allocator()) - 1) / 2; } -: 728: -: 729: /** -: 730: * @brief Resizes the %string to the specified number of characters. -: 731: * @param __n Number of characters the %string should contain. -: 732: * @param __c Character to fill any new elements. -: 733: * -: 734: * This function will %resize the %string to the specified -: 735: * number of characters. If the number is smaller than the -: 736: * %string's current size the %string is truncated, otherwise -: 737: * the %string is extended and new elements are %set to @a __c. -: 738: */ -: 739: void -: 740: resize(size_type __n, _CharT __c); -: 741: -: 742: /** -: 743: * @brief Resizes the %string to the specified number of characters. -: 744: * @param __n Number of characters the %string should contain. -: 745: * -: 746: * This function will resize the %string to the specified length. If -: 747: * the new size is smaller than the %string's current size the %string -: 748: * is truncated, otherwise the %string is extended and new characters -: 749: * are default-constructed. For basic types such as char, this means -: 750: * setting them to 0. -: 751: */ -: 752: void -: 753: resize(size_type __n) -: 754: { this->resize(__n, _CharT()); } -: 755: -: 756:#if __cplusplus >= 201103L -: 757: /// A non-binding request to reduce capacity() to size(). -: 758: void -: 759: shrink_to_fit() noexcept -: 760: { -: 761:#if __cpp_exceptions -: 762: if (capacity() > size()) -: 763: { -: 764: try -: 765: { reserve(0); } -: 766: catch(...) -: 767: { } -: 768: } -: 769:#endif -: 770: } -: 771:#endif -: 772: -: 773: /** -: 774: * Returns the total number of characters that the %string can hold -: 775: * before needing to allocate more memory. -: 776: */ -: 777: size_type -: 778: capacity() const _GLIBCXX_NOEXCEPT -: 779: { -: 780: return _M_is_local() ? size_type(_S_local_capacity) -: 781: : _M_allocated_capacity; -: 782: } -: 783: -: 784: /** -: 785: * @brief Attempt to preallocate enough memory for specified number of -: 786: * characters. -: 787: * @param __res_arg Number of characters required. -: 788: * @throw std::length_error If @a __res_arg exceeds @c max_size(). -: 789: * -: 790: * This function attempts to reserve enough memory for the -: 791: * %string to hold the specified number of characters. If the -: 792: * number requested is more than max_size(), length_error is -: 793: * thrown. -: 794: * -: 795: * The advantage of this function is that if optimal code is a -: 796: * necessity and the user can determine the string length that will be -: 797: * required, the user can reserve the memory in %advance, and thus -: 798: * prevent a possible reallocation of memory and copying of %string -: 799: * data. -: 800: */ -: 801: void -: 802: reserve(size_type __res_arg = 0); -: 803: -: 804: /** -: 805: * Erases the string, making it empty. -: 806: */ -: 807: void -: 808: clear() _GLIBCXX_NOEXCEPT -: 809: { _M_set_length(0); } -: 810: -: 811: /** -: 812: * Returns true if the %string is empty. Equivalent to -: 813: * *this == "". -: 814: */ -: 815: bool -: 816: empty() const _GLIBCXX_NOEXCEPT -: 817: { return this->size() == 0; } -: 818: -: 819: // Element access: -: 820: /** -: 821: * @brief Subscript access to the data contained in the %string. -: 822: * @param __pos The index of the character to access. -: 823: * @return Read-only (constant) reference to the character. -: 824: * -: 825: * This operator allows for easy, array-style, data access. -: 826: * Note that data access with this operator is unchecked and -: 827: * out_of_range lookups are not defined. (For checked lookups -: 828: * see at().) -: 829: */ -: 830: const_reference -: 831: operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT -: 832: { -: 833: _GLIBCXX_DEBUG_ASSERT(__pos <= size()); -: 834: return _M_data()[__pos]; -: 835: } -: 836: -: 837: /** -: 838: * @brief Subscript access to the data contained in the %string. -: 839: * @param __pos The index of the character to access. -: 840: * @return Read/write reference to the character. -: 841: * -: 842: * This operator allows for easy, array-style, data access. -: 843: * Note that data access with this operator is unchecked and -: 844: * out_of_range lookups are not defined. (For checked lookups -: 845: * see at().) -: 846: */ -: 847: reference -: 848: operator[](size_type __pos) -: 849: { -: 850: // Allow pos == size() both in C++98 mode, as v3 extension, -: 851: // and in C++11 mode. -: 852: _GLIBCXX_DEBUG_ASSERT(__pos <= size()); -: 853: // In pedantic mode be strict in C++98 mode. -: 854: _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos < size()); -: 855: return _M_data()[__pos]; -: 856: } -: 857: -: 858: /** -: 859: * @brief Provides access to the data contained in the %string. -: 860: * @param __n The index of the character to access. -: 861: * @return Read-only (const) reference to the character. -: 862: * @throw std::out_of_range If @a n is an invalid index. -: 863: * -: 864: * This function provides for safer data access. The parameter is -: 865: * first checked that it is in the range of the string. The function -: 866: * throws out_of_range if the check fails. -: 867: */ -: 868: const_reference -: 869: at(size_type __n) const -: 870: { -: 871: if (__n >= this->size()) -: 872: __throw_out_of_range_fmt(__N("basic_string::at: __n " -: 873: "(which is %zu) >= this->size() " -: 874: "(which is %zu)"), -: 875: __n, this->size()); -: 876: return _M_data()[__n]; -: 877: } -: 878: -: 879: /** -: 880: * @brief Provides access to the data contained in the %string. -: 881: * @param __n The index of the character to access. -: 882: * @return Read/write reference to the character. -: 883: * @throw std::out_of_range If @a n is an invalid index. -: 884: * -: 885: * This function provides for safer data access. The parameter is -: 886: * first checked that it is in the range of the string. The function -: 887: * throws out_of_range if the check fails. -: 888: */ -: 889: reference -: 890: at(size_type __n) -: 891: { -: 892: if (__n >= size()) -: 893: __throw_out_of_range_fmt(__N("basic_string::at: __n " -: 894: "(which is %zu) >= this->size() " -: 895: "(which is %zu)"), -: 896: __n, this->size()); -: 897: return _M_data()[__n]; -: 898: } -: 899: -: 900:#if __cplusplus >= 201103L -: 901: /** -: 902: * Returns a read/write reference to the data at the first -: 903: * element of the %string. -: 904: */ -: 905: reference -: 906: front() noexcept -: 907: { return operator[](0); } -: 908: -: 909: /** -: 910: * Returns a read-only (constant) reference to the data at the first -: 911: * element of the %string. -: 912: */ -: 913: const_reference -: 914: front() const noexcept -: 915: { return operator[](0); } -: 916: -: 917: /** -: 918: * Returns a read/write reference to the data at the last -: 919: * element of the %string. -: 920: */ -: 921: reference -: 922: back() noexcept -: 923: { return operator[](this->size() - 1); } -: 924: -: 925: /** -: 926: * Returns a read-only (constant) reference to the data at the -: 927: * last element of the %string. -: 928: */ -: 929: const_reference -: 930: back() const noexcept -: 931: { return operator[](this->size() - 1); } -: 932:#endif -: 933: -: 934: // Modifiers: -: 935: /** -: 936: * @brief Append a string to this string. -: 937: * @param __str The string to append. -: 938: * @return Reference to this string. -: 939: */ -: 940: basic_string& -: 941: operator+=(const basic_string& __str) -: 942: { return this->append(__str); } -: 943: -: 944: /** -: 945: * @brief Append a C string. -: 946: * @param __s The C string to append. -: 947: * @return Reference to this string. -: 948: */ -: 949: basic_string& -: 950: operator+=(const _CharT* __s) -: 951: { return this->append(__s); } -: 952: -: 953: /** -: 954: * @brief Append a character. -: 955: * @param __c The character to append. -: 956: * @return Reference to this string. -: 957: */ -: 958: basic_string& -: 959: operator+=(_CharT __c) -: 960: { -: 961: this->push_back(__c); -: 962: return *this; -: 963: } -: 964: -: 965:#if __cplusplus >= 201103L -: 966: /** -: 967: * @brief Append an initializer_list of characters. -: 968: * @param __l The initializer_list of characters to be appended. -: 969: * @return Reference to this string. -: 970: */ -: 971: basic_string& -: 972: operator+=(initializer_list<_CharT> __l) -: 973: { return this->append(__l.begin(), __l.size()); } -: 974:#endif // C++11 -: 975: -: 976: /** -: 977: * @brief Append a string to this string. -: 978: * @param __str The string to append. -: 979: * @return Reference to this string. -: 980: */ -: 981: basic_string& -: 982: append(const basic_string& __str) -: 983: { return _M_append(__str._M_data(), __str.size()); } -: 984: -: 985: /** -: 986: * @brief Append a substring. -: 987: * @param __str The string to append. -: 988: * @param __pos Index of the first character of str to append. -: 989: * @param __n The number of characters to append. -: 990: * @return Reference to this string. -: 991: * @throw std::out_of_range if @a __pos is not a valid index. -: 992: * -: 993: * This function appends @a __n characters from @a __str -: 994: * starting at @a __pos to this string. If @a __n is is larger -: 995: * than the number of available characters in @a __str, the -: 996: * remainder of @a __str is appended. -: 997: */ -: 998: basic_string& -: 999: append(const basic_string& __str, size_type __pos, size_type __n) -: 1000: { return _M_append(__str._M_data() -: 1001: + __str._M_check(__pos, "basic_string::append"), -: 1002: __str._M_limit(__pos, __n)); } -: 1003: -: 1004: /** -: 1005: * @brief Append a C substring. -: 1006: * @param __s The C string to append. -: 1007: * @param __n The number of characters to append. -: 1008: * @return Reference to this string. -: 1009: */ -: 1010: basic_string& -: 1011: append(const _CharT* __s, size_type __n) -: 1012: { -: 1013: __glibcxx_requires_string_len(__s, __n); -: 1014: _M_check_length(size_type(0), __n, "basic_string::append"); -: 1015: return _M_append(__s, __n); -: 1016: } -: 1017: -: 1018: /** -: 1019: * @brief Append a C string. -: 1020: * @param __s The C string to append. -: 1021: * @return Reference to this string. -: 1022: */ -: 1023: basic_string& -: 1024: append(const _CharT* __s) -: 1025: { -: 1026: __glibcxx_requires_string(__s); -: 1027: const size_type __n = traits_type::length(__s); -: 1028: _M_check_length(size_type(0), __n, "basic_string::append"); -: 1029: return _M_append(__s, __n); -: 1030: } -: 1031: -: 1032: /** -: 1033: * @brief Append multiple characters. -: 1034: * @param __n The number of characters to append. -: 1035: * @param __c The character to use. -: 1036: * @return Reference to this string. -: 1037: * -: 1038: * Appends __n copies of __c to this string. -: 1039: */ -: 1040: basic_string& -: 1041: append(size_type __n, _CharT __c) -: 1042: { return _M_replace_aux(this->size(), size_type(0), __n, __c); } -: 1043: -: 1044:#if __cplusplus >= 201103L -: 1045: /** -: 1046: * @brief Append an initializer_list of characters. -: 1047: * @param __l The initializer_list of characters to append. -: 1048: * @return Reference to this string. -: 1049: */ -: 1050: basic_string& -: 1051: append(initializer_list<_CharT> __l) -: 1052: { return this->append(__l.begin(), __l.size()); } -: 1053:#endif // C++11 -: 1054: -: 1055: /** -: 1056: * @brief Append a range of characters. -: 1057: * @param __first Iterator referencing the first character to append. -: 1058: * @param __last Iterator marking the end of the range. -: 1059: * @return Reference to this string. -: 1060: * -: 1061: * Appends characters in the range [__first,__last) to this string. -: 1062: */ -: 1063:#if __cplusplus >= 201103L -: 1064: template> -: 1066:#else -: 1067: template -: 1068:#endif -: 1069: basic_string& -: 1070: append(_InputIterator __first, _InputIterator __last) -: 1071: { return this->replace(end(), end(), __first, __last); } -: 1072: -: 1073: /** -: 1074: * @brief Append a single character. -: 1075: * @param __c Character to append. -: 1076: */ -: 1077: void -: 1078: push_back(_CharT __c) -: 1079: { -: 1080: const size_type __size = this->size(); -: 1081: if (__size + 1 > this->capacity()) -: 1082: this->_M_mutate(__size, size_type(0), 0, size_type(1)); -: 1083: traits_type::assign(this->_M_data()[__size], __c); -: 1084: this->_M_set_length(__size + 1); -: 1085: } -: 1086: -: 1087: /** -: 1088: * @brief Set value to contents of another string. -: 1089: * @param __str Source string to use. -: 1090: * @return Reference to this string. -: 1091: */ -: 1092: basic_string& -: 1093: assign(const basic_string& __str) -: 1094: { -: 1095: this->_M_assign(__str); -: 1096: return *this; -: 1097: } -: 1098: -: 1099:#if __cplusplus >= 201103L -: 1100: /** -: 1101: * @brief Set value to contents of another string. -: 1102: * @param __str Source string to use. -: 1103: * @return Reference to this string. -: 1104: * -: 1105: * This function sets this string to the exact contents of @a __str. -: 1106: * @a __str is a valid, but unspecified string. -: 1107: */ -: 1108: basic_string& -: 1109: assign(basic_string&& __str) -: 1110: { -: 1111: // _GLIBCXX_RESOLVE_LIB_DEFECTS -: 1112: // 2063. Contradictory requirements for string move assignment -: 1113: return *this = std::move(__str); -: 1114: } -: 1115:#endif // C++11 -: 1116: -: 1117: /** -: 1118: * @brief Set value to a substring of a string. -: 1119: * @param __str The string to use. -: 1120: * @param __pos Index of the first character of str. -: 1121: * @param __n Number of characters to use. -: 1122: * @return Reference to this string. -: 1123: * @throw std::out_of_range if @a pos is not a valid index. -: 1124: * -: 1125: * This function sets this string to the substring of @a __str -: 1126: * consisting of @a __n characters at @a __pos. If @a __n is -: 1127: * is larger than the number of available characters in @a -: 1128: * __str, the remainder of @a __str is used. -: 1129: */ -: 1130: basic_string& -: 1131: assign(const basic_string& __str, size_type __pos, size_type __n) -: 1132: { return _M_replace(size_type(0), this->size(), __str._M_data() -: 1133: + __str._M_check(__pos, "basic_string::assign"), -: 1134: __str._M_limit(__pos, __n)); } -: 1135: -: 1136: /** -: 1137: * @brief Set value to a C substring. -: 1138: * @param __s The C string to use. -: 1139: * @param __n Number of characters to use. -: 1140: * @return Reference to this string. -: 1141: * -: 1142: * This function sets the value of this string to the first @a __n -: 1143: * characters of @a __s. If @a __n is is larger than the number of -: 1144: * available characters in @a __s, the remainder of @a __s is used. -: 1145: */ -: 1146: basic_string& -: 1147: assign(const _CharT* __s, size_type __n) -: 1148: { -: 1149: __glibcxx_requires_string_len(__s, __n); -: 1150: return _M_replace(size_type(0), this->size(), __s, __n); -: 1151: } -: 1152: -: 1153: /** -: 1154: * @brief Set value to contents of a C string. -: 1155: * @param __s The C string to use. -: 1156: * @return Reference to this string. -: 1157: * -: 1158: * This function sets the value of this string to the value of @a __s. -: 1159: * The data is copied, so there is no dependence on @a __s once the -: 1160: * function returns. -: 1161: */ -: 1162: basic_string& -: 1163: assign(const _CharT* __s) -: 1164: { -: 1165: __glibcxx_requires_string(__s); -: 1166: return _M_replace(size_type(0), this->size(), __s, -: 1167: traits_type::length(__s)); -: 1168: } -: 1169: -: 1170: /** -: 1171: * @brief Set value to multiple characters. -: 1172: * @param __n Length of the resulting string. -: 1173: * @param __c The character to use. -: 1174: * @return Reference to this string. -: 1175: * -: 1176: * This function sets the value of this string to @a __n copies of -: 1177: * character @a __c. -: 1178: */ -: 1179: basic_string& -: 1180: assign(size_type __n, _CharT __c) -: 1181: { return _M_replace_aux(size_type(0), this->size(), __n, __c); } -: 1182: -: 1183: /** -: 1184: * @brief Set value to a range of characters. -: 1185: * @param __first Iterator referencing the first character to append. -: 1186: * @param __last Iterator marking the end of the range. -: 1187: * @return Reference to this string. -: 1188: * -: 1189: * Sets value of string to characters in the range [__first,__last). -: 1190: */ -: 1191:#if __cplusplus >= 201103L -: 1192: template> -: 1194:#else -: 1195: template -: 1196:#endif -: 1197: basic_string& -: 1198: assign(_InputIterator __first, _InputIterator __last) -: 1199: { return this->replace(begin(), end(), __first, __last); } -: 1200: -: 1201:#if __cplusplus >= 201103L -: 1202: /** -: 1203: * @brief Set value to an initializer_list of characters. -: 1204: * @param __l The initializer_list of characters to assign. -: 1205: * @return Reference to this string. -: 1206: */ -: 1207: basic_string& -: 1208: assign(initializer_list<_CharT> __l) -: 1209: { return this->assign(__l.begin(), __l.size()); } -: 1210:#endif // C++11 -: 1211: -: 1212:#if __cplusplus >= 201103L -: 1213: /** -: 1214: * @brief Insert multiple characters. -: 1215: * @param __p Const_iterator referencing location in string to -: 1216: * insert at. -: 1217: * @param __n Number of characters to insert -: 1218: * @param __c The character to insert. -: 1219: * @return Iterator referencing the first inserted char. -: 1220: * @throw std::length_error If new length exceeds @c max_size(). -: 1221: * -: 1222: * Inserts @a __n copies of character @a __c starting at the -: 1223: * position referenced by iterator @a __p. If adding -: 1224: * characters causes the length to exceed max_size(), -: 1225: * length_error is thrown. The value of the string doesn't -: 1226: * change if an error is thrown. -: 1227: */ -: 1228: iterator -: 1229: insert(const_iterator __p, size_type __n, _CharT __c) -: 1230: { -: 1231: _GLIBCXX_DEBUG_PEDASSERT(__p >= begin() && __p <= end()); -: 1232: const size_type __pos = __p - begin(); -: 1233: this->replace(__p, __p, __n, __c); -: 1234: return iterator(this->_M_data() + __pos); -: 1235: } -: 1236:#else -: 1237: /** -: 1238: * @brief Insert multiple characters. -: 1239: * @param __p Iterator referencing location in string to insert at. -: 1240: * @param __n Number of characters to insert -: 1241: * @param __c The character to insert. -: 1242: * @throw std::length_error If new length exceeds @c max_size(). -: 1243: * -: 1244: * Inserts @a __n copies of character @a __c starting at the -: 1245: * position referenced by iterator @a __p. If adding -: 1246: * characters causes the length to exceed max_size(), -: 1247: * length_error is thrown. The value of the string doesn't -: 1248: * change if an error is thrown. -: 1249: */ -: 1250: void -: 1251: insert(iterator __p, size_type __n, _CharT __c) -: 1252: { this->replace(__p, __p, __n, __c); } -: 1253:#endif -: 1254: -: 1255:#if __cplusplus >= 201103L -: 1256: /** -: 1257: * @brief Insert a range of characters. -: 1258: * @param __p Const_iterator referencing location in string to -: 1259: * insert at. -: 1260: * @param __beg Start of range. -: 1261: * @param __end End of range. -: 1262: * @return Iterator referencing the first inserted char. -: 1263: * @throw std::length_error If new length exceeds @c max_size(). -: 1264: * -: 1265: * Inserts characters in range [beg,end). If adding characters -: 1266: * causes the length to exceed max_size(), length_error is -: 1267: * thrown. The value of the string doesn't change if an error -: 1268: * is thrown. -: 1269: */ -: 1270: template> -: 1272: iterator -: 1273: insert(const_iterator __p, _InputIterator __beg, _InputIterator __end) -: 1274: { -: 1275: _GLIBCXX_DEBUG_PEDASSERT(__p >= begin() && __p <= end()); -: 1276: const size_type __pos = __p - begin(); -: 1277: this->replace(__p, __p, __beg, __end); -: 1278: return iterator(this->_M_data() + __pos); -: 1279: } -: 1280:#else -: 1281: /** -: 1282: * @brief Insert a range of characters. -: 1283: * @param __p Iterator referencing location in string to insert at. -: 1284: * @param __beg Start of range. -: 1285: * @param __end End of range. -: 1286: * @throw std::length_error If new length exceeds @c max_size(). -: 1287: * -: 1288: * Inserts characters in range [__beg,__end). If adding -: 1289: * characters causes the length to exceed max_size(), -: 1290: * length_error is thrown. The value of the string doesn't -: 1291: * change if an error is thrown. -: 1292: */ -: 1293: template -: 1294: void -: 1295: insert(iterator __p, _InputIterator __beg, _InputIterator __end) -: 1296: { this->replace(__p, __p, __beg, __end); } -: 1297:#endif -: 1298: -: 1299:#if __cplusplus >= 201103L -: 1300: /** -: 1301: * @brief Insert an initializer_list of characters. -: 1302: * @param __p Iterator referencing location in string to insert at. -: 1303: * @param __l The initializer_list of characters to insert. -: 1304: * @throw std::length_error If new length exceeds @c max_size(). -: 1305: */ -: 1306: void -: 1307: insert(iterator __p, initializer_list<_CharT> __l) -: 1308: { -: 1309: _GLIBCXX_DEBUG_PEDASSERT(__p >= begin() && __p <= end()); -: 1310: this->insert(__p - begin(), __l.begin(), __l.size()); -: 1311: } -: 1312:#endif // C++11 -: 1313: -: 1314: /** -: 1315: * @brief Insert value of a string. -: 1316: * @param __pos1 Iterator referencing location in string to insert at. -: 1317: * @param __str The string to insert. -: 1318: * @return Reference to this string. -: 1319: * @throw std::length_error If new length exceeds @c max_size(). -: 1320: * -: 1321: * Inserts value of @a __str starting at @a __pos1. If adding -: 1322: * characters causes the length to exceed max_size(), -: 1323: * length_error is thrown. The value of the string doesn't -: 1324: * change if an error is thrown. -: 1325: */ -: 1326: basic_string& -: 1327: insert(size_type __pos1, const basic_string& __str) -: 1328: { return this->replace(__pos1, size_type(0), -: 1329: __str._M_data(), __str.size()); } -: 1330: -: 1331: /** -: 1332: * @brief Insert a substring. -: 1333: * @param __pos1 Iterator referencing location in string to insert at. -: 1334: * @param __str The string to insert. -: 1335: * @param __pos2 Start of characters in str to insert. -: 1336: * @param __n Number of characters to insert. -: 1337: * @return Reference to this string. -: 1338: * @throw std::length_error If new length exceeds @c max_size(). -: 1339: * @throw std::out_of_range If @a pos1 > size() or -: 1340: * @a __pos2 > @a str.size(). -: 1341: * -: 1342: * Starting at @a pos1, insert @a __n character of @a __str -: 1343: * beginning with @a __pos2. If adding characters causes the -: 1344: * length to exceed max_size(), length_error is thrown. If @a -: 1345: * __pos1 is beyond the end of this string or @a __pos2 is -: 1346: * beyond the end of @a __str, out_of_range is thrown. The -: 1347: * value of the string doesn't change if an error is thrown. -: 1348: */ -: 1349: basic_string& -: 1350: insert(size_type __pos1, const basic_string& __str, -: 1351: size_type __pos2, size_type __n) -: 1352: { return this->replace(__pos1, size_type(0), __str._M_data() -: 1353: + __str._M_check(__pos2, "basic_string::insert"), -: 1354: __str._M_limit(__pos2, __n)); } -: 1355: -: 1356: /** -: 1357: * @brief Insert a C substring. -: 1358: * @param __pos Iterator referencing location in string to insert at. -: 1359: * @param __s The C string to insert. -: 1360: * @param __n The number of characters to insert. -: 1361: * @return Reference to this string. -: 1362: * @throw std::length_error If new length exceeds @c max_size(). -: 1363: * @throw std::out_of_range If @a __pos is beyond the end of this -: 1364: * string. -: 1365: * -: 1366: * Inserts the first @a __n characters of @a __s starting at @a -: 1367: * __pos. If adding characters causes the length to exceed -: 1368: * max_size(), length_error is thrown. If @a __pos is beyond -: 1369: * end(), out_of_range is thrown. The value of the string -: 1370: * doesn't change if an error is thrown. -: 1371: */ -: 1372: basic_string& -: 1373: insert(size_type __pos, const _CharT* __s, size_type __n) -: 1374: { return this->replace(__pos, size_type(0), __s, __n); } -: 1375: -: 1376: /** -: 1377: * @brief Insert a C string. -: 1378: * @param __pos Iterator referencing location in string to insert at. -: 1379: * @param __s The C string to insert. -: 1380: * @return Reference to this string. -: 1381: * @throw std::length_error If new length exceeds @c max_size(). -: 1382: * @throw std::out_of_range If @a pos is beyond the end of this -: 1383: * string. -: 1384: * -: 1385: * Inserts the first @a n characters of @a __s starting at @a __pos. If -: 1386: * adding characters causes the length to exceed max_size(), -: 1387: * length_error is thrown. If @a __pos is beyond end(), out_of_range is -: 1388: * thrown. The value of the string doesn't change if an error is -: 1389: * thrown. -: 1390: */ -: 1391: basic_string& -: 1392: insert(size_type __pos, const _CharT* __s) -: 1393: { -: 1394: __glibcxx_requires_string(__s); -: 1395: return this->replace(__pos, size_type(0), __s, -: 1396: traits_type::length(__s)); -: 1397: } -: 1398: -: 1399: /** -: 1400: * @brief Insert multiple characters. -: 1401: * @param __pos Index in string to insert at. -: 1402: * @param __n Number of characters to insert -: 1403: * @param __c The character to insert. -: 1404: * @return Reference to this string. -: 1405: * @throw std::length_error If new length exceeds @c max_size(). -: 1406: * @throw std::out_of_range If @a __pos is beyond the end of this -: 1407: * string. -: 1408: * -: 1409: * Inserts @a __n copies of character @a __c starting at index -: 1410: * @a __pos. If adding characters causes the length to exceed -: 1411: * max_size(), length_error is thrown. If @a __pos > length(), -: 1412: * out_of_range is thrown. The value of the string doesn't -: 1413: * change if an error is thrown. -: 1414: */ -: 1415: basic_string& -: 1416: insert(size_type __pos, size_type __n, _CharT __c) -: 1417: { return _M_replace_aux(_M_check(__pos, "basic_string::insert"), -: 1418: size_type(0), __n, __c); } -: 1419: -: 1420: /** -: 1421: * @brief Insert one character. -: 1422: * @param __p Iterator referencing position in string to insert at. -: 1423: * @param __c The character to insert. -: 1424: * @return Iterator referencing newly inserted char. -: 1425: * @throw std::length_error If new length exceeds @c max_size(). -: 1426: * -: 1427: * Inserts character @a __c at position referenced by @a __p. -: 1428: * If adding character causes the length to exceed max_size(), -: 1429: * length_error is thrown. If @a __p is beyond end of string, -: 1430: * out_of_range is thrown. The value of the string doesn't -: 1431: * change if an error is thrown. -: 1432: */ -: 1433: iterator -: 1434: insert(__const_iterator __p, _CharT __c) -: 1435: { -: 1436: _GLIBCXX_DEBUG_PEDASSERT(__p >= begin() && __p <= end()); -: 1437: const size_type __pos = __p - begin(); -: 1438: _M_replace_aux(__pos, size_type(0), size_type(1), __c); -: 1439: return iterator(_M_data() + __pos); -: 1440: } -: 1441: -: 1442: /** -: 1443: * @brief Remove characters. -: 1444: * @param __pos Index of first character to remove (default 0). -: 1445: * @param __n Number of characters to remove (default remainder). -: 1446: * @return Reference to this string. -: 1447: * @throw std::out_of_range If @a pos is beyond the end of this -: 1448: * string. -: 1449: * -: 1450: * Removes @a __n characters from this string starting at @a -: 1451: * __pos. The length of the string is reduced by @a __n. If -: 1452: * there are < @a __n characters to remove, the remainder of -: 1453: * the string is truncated. If @a __p is beyond end of string, -: 1454: * out_of_range is thrown. The value of the string doesn't -: 1455: * change if an error is thrown. -: 1456: */ -: 1457: basic_string& -: 1458: erase(size_type __pos = 0, size_type __n = npos) -: 1459: { -: 1460: this->_M_erase(_M_check(__pos, "basic_string::erase"), -: 1461: _M_limit(__pos, __n)); -: 1462: return *this; -: 1463: } -: 1464: -: 1465: /** -: 1466: * @brief Remove one character. -: 1467: * @param __position Iterator referencing the character to remove. -: 1468: * @return iterator referencing same location after removal. -: 1469: * -: 1470: * Removes the character at @a __position from this string. The value -: 1471: * of the string doesn't change if an error is thrown. -: 1472: */ -: 1473: iterator -: 1474: erase(__const_iterator __position) -: 1475: { -: 1476: _GLIBCXX_DEBUG_PEDASSERT(__position >= begin() -: 1477: && __position < end()); -: 1478: const size_type __pos = __position - begin(); -: 1479: this->_M_erase(__pos, size_type(1)); -: 1480: return iterator(_M_data() + __pos); -: 1481: } -: 1482: -: 1483: /** -: 1484: * @brief Remove a range of characters. -: 1485: * @param __first Iterator referencing the first character to remove. -: 1486: * @param __last Iterator referencing the end of the range. -: 1487: * @return Iterator referencing location of first after removal. -: 1488: * -: 1489: * Removes the characters in the range [first,last) from this string. -: 1490: * The value of the string doesn't change if an error is thrown. -: 1491: */ -: 1492: iterator -: 1493: erase(__const_iterator __first, __const_iterator __last) -: 1494: { -: 1495: _GLIBCXX_DEBUG_PEDASSERT(__first >= begin() && __first <= __last -: 1496: && __last <= end()); -: 1497: const size_type __pos = __first - begin(); -: 1498: this->_M_erase(__pos, __last - __first); -: 1499: return iterator(this->_M_data() + __pos); -: 1500: } -: 1501: -: 1502:#if __cplusplus >= 201103L -: 1503: /** -: 1504: * @brief Remove the last character. -: 1505: * -: 1506: * The string must be non-empty. -: 1507: */ -: 1508: void -: 1509: pop_back() noexcept -: 1510: { _M_erase(size()-1, 1); } -: 1511:#endif // C++11 -: 1512: -: 1513: /** -: 1514: * @brief Replace characters with value from another string. -: 1515: * @param __pos Index of first character to replace. -: 1516: * @param __n Number of characters to be replaced. -: 1517: * @param __str String to insert. -: 1518: * @return Reference to this string. -: 1519: * @throw std::out_of_range If @a pos is beyond the end of this -: 1520: * string. -: 1521: * @throw std::length_error If new length exceeds @c max_size(). -: 1522: * -: 1523: * Removes the characters in the range [__pos,__pos+__n) from -: 1524: * this string. In place, the value of @a __str is inserted. -: 1525: * If @a __pos is beyond end of string, out_of_range is thrown. -: 1526: * If the length of the result exceeds max_size(), length_error -: 1527: * is thrown. The value of the string doesn't change if an -: 1528: * error is thrown. -: 1529: */ -: 1530: basic_string& -: 1531: replace(size_type __pos, size_type __n, const basic_string& __str) -: 1532: { return this->replace(__pos, __n, __str._M_data(), __str.size()); } -: 1533: -: 1534: /** -: 1535: * @brief Replace characters with value from another string. -: 1536: * @param __pos1 Index of first character to replace. -: 1537: * @param __n1 Number of characters to be replaced. -: 1538: * @param __str String to insert. -: 1539: * @param __pos2 Index of first character of str to use. -: 1540: * @param __n2 Number of characters from str to use. -: 1541: * @return Reference to this string. -: 1542: * @throw std::out_of_range If @a __pos1 > size() or @a __pos2 > -: 1543: * __str.size(). -: 1544: * @throw std::length_error If new length exceeds @c max_size(). -: 1545: * -: 1546: * Removes the characters in the range [__pos1,__pos1 + n) from this -: 1547: * string. In place, the value of @a __str is inserted. If @a __pos is -: 1548: * beyond end of string, out_of_range is thrown. If the length of the -: 1549: * result exceeds max_size(), length_error is thrown. The value of the -: 1550: * string doesn't change if an error is thrown. -: 1551: */ -: 1552: basic_string& -: 1553: replace(size_type __pos1, size_type __n1, const basic_string& __str, -: 1554: size_type __pos2, size_type __n2) -: 1555: { return this->replace(__pos1, __n1, __str._M_data() -: 1556: + __str._M_check(__pos2, "basic_string::replace"), -: 1557: __str._M_limit(__pos2, __n2)); } -: 1558: -: 1559: /** -: 1560: * @brief Replace characters with value of a C substring. -: 1561: * @param __pos Index of first character to replace. -: 1562: * @param __n1 Number of characters to be replaced. -: 1563: * @param __s C string to insert. -: 1564: * @param __n2 Number of characters from @a s to use. -: 1565: * @return Reference to this string. -: 1566: * @throw std::out_of_range If @a pos1 > size(). -: 1567: * @throw std::length_error If new length exceeds @c max_size(). -: 1568: * -: 1569: * Removes the characters in the range [__pos,__pos + __n1) -: 1570: * from this string. In place, the first @a __n2 characters of -: 1571: * @a __s are inserted, or all of @a __s if @a __n2 is too large. If -: 1572: * @a __pos is beyond end of string, out_of_range is thrown. If -: 1573: * the length of result exceeds max_size(), length_error is -: 1574: * thrown. The value of the string doesn't change if an error -: 1575: * is thrown. -: 1576: */ -: 1577: basic_string& -: 1578: replace(size_type __pos, size_type __n1, const _CharT* __s, -: 1579: size_type __n2) -: 1580: { -: 1581: __glibcxx_requires_string_len(__s, __n2); -: 1582: return _M_replace(_M_check(__pos, "basic_string::replace"), -: 1583: _M_limit(__pos, __n1), __s, __n2); -: 1584: } -: 1585: -: 1586: /** -: 1587: * @brief Replace characters with value of a C string. -: 1588: * @param __pos Index of first character to replace. -: 1589: * @param __n1 Number of characters to be replaced. -: 1590: * @param __s C string to insert. -: 1591: * @return Reference to this string. -: 1592: * @throw std::out_of_range If @a pos > size(). -: 1593: * @throw std::length_error If new length exceeds @c max_size(). -: 1594: * -: 1595: * Removes the characters in the range [__pos,__pos + __n1) -: 1596: * from this string. In place, the characters of @a __s are -: 1597: * inserted. If @a __pos is beyond end of string, out_of_range -: 1598: * is thrown. If the length of result exceeds max_size(), -: 1599: * length_error is thrown. The value of the string doesn't -: 1600: * change if an error is thrown. -: 1601: */ -: 1602: basic_string& -: 1603: replace(size_type __pos, size_type __n1, const _CharT* __s) -: 1604: { -: 1605: __glibcxx_requires_string(__s); -: 1606: return this->replace(__pos, __n1, __s, traits_type::length(__s)); -: 1607: } -: 1608: -: 1609: /** -: 1610: * @brief Replace characters with multiple characters. -: 1611: * @param __pos Index of first character to replace. -: 1612: * @param __n1 Number of characters to be replaced. -: 1613: * @param __n2 Number of characters to insert. -: 1614: * @param __c Character to insert. -: 1615: * @return Reference to this string. -: 1616: * @throw std::out_of_range If @a __pos > size(). -: 1617: * @throw std::length_error If new length exceeds @c max_size(). -: 1618: * -: 1619: * Removes the characters in the range [pos,pos + n1) from this -: 1620: * string. In place, @a __n2 copies of @a __c are inserted. -: 1621: * If @a __pos is beyond end of string, out_of_range is thrown. -: 1622: * If the length of result exceeds max_size(), length_error is -: 1623: * thrown. The value of the string doesn't change if an error -: 1624: * is thrown. -: 1625: */ -: 1626: basic_string& -: 1627: replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) -: 1628: { return _M_replace_aux(_M_check(__pos, "basic_string::replace"), -: 1629: _M_limit(__pos, __n1), __n2, __c); } -: 1630: -: 1631: /** -: 1632: * @brief Replace range of characters with string. -: 1633: * @param __i1 Iterator referencing start of range to replace. -: 1634: * @param __i2 Iterator referencing end of range to replace. -: 1635: * @param __str String value to insert. -: 1636: * @return Reference to this string. -: 1637: * @throw std::length_error If new length exceeds @c max_size(). -: 1638: * -: 1639: * Removes the characters in the range [__i1,__i2). In place, -: 1640: * the value of @a __str is inserted. If the length of result -: 1641: * exceeds max_size(), length_error is thrown. The value of -: 1642: * the string doesn't change if an error is thrown. -: 1643: */ -: 1644: basic_string& -: 1645: replace(__const_iterator __i1, __const_iterator __i2, -: 1646: const basic_string& __str) -: 1647: { return this->replace(__i1, __i2, __str._M_data(), __str.size()); } -: 1648: -: 1649: /** -: 1650: * @brief Replace range of characters with C substring. -: 1651: * @param __i1 Iterator referencing start of range to replace. -: 1652: * @param __i2 Iterator referencing end of range to replace. -: 1653: * @param __s C string value to insert. -: 1654: * @param __n Number of characters from s to insert. -: 1655: * @return Reference to this string. -: 1656: * @throw std::length_error If new length exceeds @c max_size(). -: 1657: * -: 1658: * Removes the characters in the range [__i1,__i2). In place, -: 1659: * the first @a __n characters of @a __s are inserted. If the -: 1660: * length of result exceeds max_size(), length_error is thrown. -: 1661: * The value of the string doesn't change if an error is -: 1662: * thrown. -: 1663: */ -: 1664: basic_string& -: 1665: replace(__const_iterator __i1, __const_iterator __i2, -: 1666: const _CharT* __s, size_type __n) -: 1667: { -: 1668: _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 -: 1669: && __i2 <= end()); -: 1670: return this->replace(__i1 - begin(), __i2 - __i1, __s, __n); -: 1671: } -: 1672: -: 1673: /** -: 1674: * @brief Replace range of characters with C string. -: 1675: * @param __i1 Iterator referencing start of range to replace. -: 1676: * @param __i2 Iterator referencing end of range to replace. -: 1677: * @param __s C string value to insert. -: 1678: * @return Reference to this string. -: 1679: * @throw std::length_error If new length exceeds @c max_size(). -: 1680: * -: 1681: * Removes the characters in the range [__i1,__i2). In place, -: 1682: * the characters of @a __s are inserted. If the length of -: 1683: * result exceeds max_size(), length_error is thrown. The -: 1684: * value of the string doesn't change if an error is thrown. -: 1685: */ -: 1686: basic_string& -: 1687: replace(__const_iterator __i1, __const_iterator __i2, const _CharT* __s) -: 1688: { -: 1689: __glibcxx_requires_string(__s); -: 1690: return this->replace(__i1, __i2, __s, traits_type::length(__s)); -: 1691: } -: 1692: -: 1693: /** -: 1694: * @brief Replace range of characters with multiple characters -: 1695: * @param __i1 Iterator referencing start of range to replace. -: 1696: * @param __i2 Iterator referencing end of range to replace. -: 1697: * @param __n Number of characters to insert. -: 1698: * @param __c Character to insert. -: 1699: * @return Reference to this string. -: 1700: * @throw std::length_error If new length exceeds @c max_size(). -: 1701: * -: 1702: * Removes the characters in the range [__i1,__i2). In place, -: 1703: * @a __n copies of @a __c are inserted. If the length of -: 1704: * result exceeds max_size(), length_error is thrown. The -: 1705: * value of the string doesn't change if an error is thrown. -: 1706: */ -: 1707: basic_string& -: 1708: replace(__const_iterator __i1, __const_iterator __i2, size_type __n, -: 1709: _CharT __c) -: 1710: { -: 1711: _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 -: 1712: && __i2 <= end()); -: 1713: return _M_replace_aux(__i1 - begin(), __i2 - __i1, __n, __c); -: 1714: } -: 1715: -: 1716: /** -: 1717: * @brief Replace range of characters with range. -: 1718: * @param __i1 Iterator referencing start of range to replace. -: 1719: * @param __i2 Iterator referencing end of range to replace. -: 1720: * @param __k1 Iterator referencing start of range to insert. -: 1721: * @param __k2 Iterator referencing end of range to insert. -: 1722: * @return Reference to this string. -: 1723: * @throw std::length_error If new length exceeds @c max_size(). -: 1724: * -: 1725: * Removes the characters in the range [__i1,__i2). In place, -: 1726: * characters in the range [__k1,__k2) are inserted. If the -: 1727: * length of result exceeds max_size(), length_error is thrown. -: 1728: * The value of the string doesn't change if an error is -: 1729: * thrown. -: 1730: */ -: 1731:#if __cplusplus >= 201103L -: 1732: template> -: 1734: basic_string& -: 1735: replace(const_iterator __i1, const_iterator __i2, -: 1736: _InputIterator __k1, _InputIterator __k2) -: 1737: { -: 1738: _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 -: 1739: && __i2 <= end()); -: 1740: __glibcxx_requires_valid_range(__k1, __k2); -: 1741: return this->_M_replace_dispatch(__i1, __i2, __k1, __k2, -: 1742: std::__false_type()); -: 1743: } -: 1744:#else -: 1745: template -: 1746:#ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST -: 1747: typename __enable_if_not_native_iterator<_InputIterator>::__type -: 1748:#else -: 1749: basic_string& -: 1750:#endif -: 1751: replace(iterator __i1, iterator __i2, -: 1752: _InputIterator __k1, _InputIterator __k2) -: 1753: { -: 1754: _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 -: 1755: && __i2 <= end()); -: 1756: __glibcxx_requires_valid_range(__k1, __k2); -: 1757: typedef typename std::__is_integer<_InputIterator>::__type _Integral; -: 1758: return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral()); -: 1759: } -: 1760:#endif -: 1761: -: 1762: // Specializations for the common case of pointer and iterator: -: 1763: // useful to avoid the overhead of temporary buffering in _M_replace. -: 1764: basic_string& -: 1765: replace(__const_iterator __i1, __const_iterator __i2, -: 1766: _CharT* __k1, _CharT* __k2) -: 1767: { -: 1768: _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 -: 1769: && __i2 <= end()); -: 1770: __glibcxx_requires_valid_range(__k1, __k2); -: 1771: return this->replace(__i1 - begin(), __i2 - __i1, -: 1772: __k1, __k2 - __k1); -: 1773: } -: 1774: -: 1775: basic_string& -: 1776: replace(__const_iterator __i1, __const_iterator __i2, -: 1777: const _CharT* __k1, const _CharT* __k2) -: 1778: { -: 1779: _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 -: 1780: && __i2 <= end()); -: 1781: __glibcxx_requires_valid_range(__k1, __k2); -: 1782: return this->replace(__i1 - begin(), __i2 - __i1, -: 1783: __k1, __k2 - __k1); -: 1784: } -: 1785: -: 1786: basic_string& -: 1787: replace(__const_iterator __i1, __const_iterator __i2, -: 1788: iterator __k1, iterator __k2) -: 1789: { -: 1790: _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 -: 1791: && __i2 <= end()); -: 1792: __glibcxx_requires_valid_range(__k1, __k2); -: 1793: return this->replace(__i1 - begin(), __i2 - __i1, -: 1794: __k1.base(), __k2 - __k1); -: 1795: } -: 1796: -: 1797: basic_string& -: 1798: replace(__const_iterator __i1, __const_iterator __i2, -: 1799: const_iterator __k1, const_iterator __k2) -: 1800: { -: 1801: _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 -: 1802: && __i2 <= end()); -: 1803: __glibcxx_requires_valid_range(__k1, __k2); -: 1804: return this->replace(__i1 - begin(), __i2 - __i1, -: 1805: __k1.base(), __k2 - __k1); -: 1806: } -: 1807: -: 1808:#if __cplusplus >= 201103L -: 1809: /** -: 1810: * @brief Replace range of characters with initializer_list. -: 1811: * @param __i1 Iterator referencing start of range to replace. -: 1812: * @param __i2 Iterator referencing end of range to replace. -: 1813: * @param __l The initializer_list of characters to insert. -: 1814: * @return Reference to this string. -: 1815: * @throw std::length_error If new length exceeds @c max_size(). -: 1816: * -: 1817: * Removes the characters in the range [__i1,__i2). In place, -: 1818: * characters in the range [__k1,__k2) are inserted. If the -: 1819: * length of result exceeds max_size(), length_error is thrown. -: 1820: * The value of the string doesn't change if an error is -: 1821: * thrown. -: 1822: */ -: 1823: basic_string& replace(const_iterator __i1, const_iterator __i2, -: 1824: initializer_list<_CharT> __l) -: 1825: { return this->replace(__i1, __i2, __l.begin(), __l.end()); } -: 1826:#endif // C++11 -: 1827: -: 1828: private: -: 1829: template -: 1830: basic_string& -: 1831: _M_replace_dispatch(const_iterator __i1, const_iterator __i2, -: 1832: _Integer __n, _Integer __val, __true_type) -: 1833: { return _M_replace_aux(__i1 - begin(), __i2 - __i1, __n, __val); } -: 1834: -: 1835: template -: 1836: basic_string& -: 1837: _M_replace_dispatch(const_iterator __i1, const_iterator __i2, -: 1838: _InputIterator __k1, _InputIterator __k2, -: 1839: __false_type); -: 1840: -: 1841: basic_string& -: 1842: _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, -: 1843: _CharT __c); -: 1844: -: 1845: basic_string& -: 1846: _M_replace(size_type __pos, size_type __len1, const _CharT* __s, -: 1847: const size_type __len2); -: 1848: -: 1849: basic_string& -: 1850: _M_append(const _CharT* __s, size_type __n); -: 1851: -: 1852: public: -: 1853: -: 1854: /** -: 1855: * @brief Copy substring into C string. -: 1856: * @param __s C string to copy value into. -: 1857: * @param __n Number of characters to copy. -: 1858: * @param __pos Index of first character to copy. -: 1859: * @return Number of characters actually copied -: 1860: * @throw std::out_of_range If __pos > size(). -: 1861: * -: 1862: * Copies up to @a __n characters starting at @a __pos into the -: 1863: * C string @a __s. If @a __pos is %greater than size(), -: 1864: * out_of_range is thrown. -: 1865: */ -: 1866: size_type -: 1867: copy(_CharT* __s, size_type __n, size_type __pos = 0) const; -: 1868: -: 1869: /** -: 1870: * @brief Swap contents with another string. -: 1871: * @param __s String to swap with. -: 1872: * -: 1873: * Exchanges the contents of this string with that of @a __s in constant -: 1874: * time. -: 1875: */ -: 1876: void -: 1877: swap(basic_string& __s) _GLIBCXX_NOEXCEPT; -: 1878: -: 1879: // String operations: -: 1880: /** -: 1881: * @brief Return const pointer to null-terminated contents. -: 1882: * -: 1883: * This is a handle to internal data. Do not modify or dire things may -: 1884: * happen. -: 1885: */ -: 1886: const _CharT* -: 1887: c_str() const _GLIBCXX_NOEXCEPT -: 1888: { return _M_data(); } -: 1889: -: 1890: /** -: 1891: * @brief Return const pointer to contents. -: 1892: * -: 1893: * This is a handle to internal data. Do not modify or dire things may -: 1894: * happen. -: 1895: */ -: 1896: const _CharT* -: 1897: data() const _GLIBCXX_NOEXCEPT -: 1898: { return _M_data(); } -: 1899: -: 1900: /** -: 1901: * @brief Return copy of allocator used to construct this string. -: 1902: */ -: 1903: allocator_type -: 1904: get_allocator() const _GLIBCXX_NOEXCEPT -: 1905: { return _M_get_allocator(); } -: 1906: -: 1907: /** -: 1908: * @brief Find position of a C substring. -: 1909: * @param __s C string to locate. -: 1910: * @param __pos Index of character to search from. -: 1911: * @param __n Number of characters from @a s to search for. -: 1912: * @return Index of start of first occurrence. -: 1913: * -: 1914: * Starting from @a __pos, searches forward for the first @a -: 1915: * __n characters in @a __s within this string. If found, -: 1916: * returns the index where it begins. If not found, returns -: 1917: * npos. -: 1918: */ -: 1919: size_type -: 1920: find(const _CharT* __s, size_type __pos, size_type __n) const; -: 1921: -: 1922: /** -: 1923: * @brief Find position of a string. -: 1924: * @param __str String to locate. -: 1925: * @param __pos Index of character to search from (default 0). -: 1926: * @return Index of start of first occurrence. -: 1927: * -: 1928: * Starting from @a __pos, searches forward for value of @a __str within -: 1929: * this string. If found, returns the index where it begins. If not -: 1930: * found, returns npos. -: 1931: */ -: 1932: size_type -: 1933: find(const basic_string& __str, size_type __pos = 0) const -: 1934: _GLIBCXX_NOEXCEPT -: 1935: { return this->find(__str.data(), __pos, __str.size()); } -: 1936: -: 1937: /** -: 1938: * @brief Find position of a C string. -: 1939: * @param __s C string to locate. -: 1940: * @param __pos Index of character to search from (default 0). -: 1941: * @return Index of start of first occurrence. -: 1942: * -: 1943: * Starting from @a __pos, searches forward for the value of @a -: 1944: * __s within this string. If found, returns the index where -: 1945: * it begins. If not found, returns npos. -: 1946: */ -: 1947: size_type -: 1948: find(const _CharT* __s, size_type __pos = 0) const -: 1949: { -: 1950: __glibcxx_requires_string(__s); -: 1951: return this->find(__s, __pos, traits_type::length(__s)); -: 1952: } -: 1953: -: 1954: /** -: 1955: * @brief Find position of a character. -: 1956: * @param __c Character to locate. -: 1957: * @param __pos Index of character to search from (default 0). -: 1958: * @return Index of first occurrence. -: 1959: * -: 1960: * Starting from @a __pos, searches forward for @a __c within -: 1961: * this string. If found, returns the index where it was -: 1962: * found. If not found, returns npos. -: 1963: */ -: 1964: size_type -: 1965: find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT; -: 1966: -: 1967: /** -: 1968: * @brief Find last position of a string. -: 1969: * @param __str String to locate. -: 1970: * @param __pos Index of character to search back from (default end). -: 1971: * @return Index of start of last occurrence. -: 1972: * -: 1973: * Starting from @a __pos, searches backward for value of @a -: 1974: * __str within this string. If found, returns the index where -: 1975: * it begins. If not found, returns npos. -: 1976: */ -: 1977: size_type -: 1978: rfind(const basic_string& __str, size_type __pos = npos) const -: 1979: _GLIBCXX_NOEXCEPT -: 1980: { return this->rfind(__str.data(), __pos, __str.size()); } -: 1981: -: 1982: /** -: 1983: * @brief Find last position of a C substring. -: 1984: * @param __s C string to locate. -: 1985: * @param __pos Index of character to search back from. -: 1986: * @param __n Number of characters from s to search for. -: 1987: * @return Index of start of last occurrence. -: 1988: * -: 1989: * Starting from @a __pos, searches backward for the first @a -: 1990: * __n characters in @a __s within this string. If found, -: 1991: * returns the index where it begins. If not found, returns -: 1992: * npos. -: 1993: */ -: 1994: size_type -: 1995: rfind(const _CharT* __s, size_type __pos, size_type __n) const; -: 1996: -: 1997: /** -: 1998: * @brief Find last position of a C string. -: 1999: * @param __s C string to locate. -: 2000: * @param __pos Index of character to start search at (default end). -: 2001: * @return Index of start of last occurrence. -: 2002: * -: 2003: * Starting from @a __pos, searches backward for the value of -: 2004: * @a __s within this string. If found, returns the index -: 2005: * where it begins. If not found, returns npos. -: 2006: */ -: 2007: size_type -: 2008: rfind(const _CharT* __s, size_type __pos = npos) const -: 2009: { -: 2010: __glibcxx_requires_string(__s); -: 2011: return this->rfind(__s, __pos, traits_type::length(__s)); -: 2012: } -: 2013: -: 2014: /** -: 2015: * @brief Find last position of a character. -: 2016: * @param __c Character to locate. -: 2017: * @param __pos Index of character to search back from (default end). -: 2018: * @return Index of last occurrence. -: 2019: * -: 2020: * Starting from @a __pos, searches backward for @a __c within -: 2021: * this string. If found, returns the index where it was -: 2022: * found. If not found, returns npos. -: 2023: */ -: 2024: size_type -: 2025: rfind(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT; -: 2026: -: 2027: /** -: 2028: * @brief Find position of a character of string. -: 2029: * @param __str String containing characters to locate. -: 2030: * @param __pos Index of character to search from (default 0). -: 2031: * @return Index of first occurrence. -: 2032: * -: 2033: * Starting from @a __pos, searches forward for one of the -: 2034: * characters of @a __str within this string. If found, -: 2035: * returns the index where it was found. If not found, returns -: 2036: * npos. -: 2037: */ -: 2038: size_type -: 2039: find_first_of(const basic_string& __str, size_type __pos = 0) const -: 2040: _GLIBCXX_NOEXCEPT -: 2041: { return this->find_first_of(__str.data(), __pos, __str.size()); } -: 2042: -: 2043: /** -: 2044: * @brief Find position of a character of C substring. -: 2045: * @param __s String containing characters to locate. -: 2046: * @param __pos Index of character to search from. -: 2047: * @param __n Number of characters from s to search for. -: 2048: * @return Index of first occurrence. -: 2049: * -: 2050: * Starting from @a __pos, searches forward for one of the -: 2051: * first @a __n characters of @a __s within this string. If -: 2052: * found, returns the index where it was found. If not found, -: 2053: * returns npos. -: 2054: */ -: 2055: size_type -: 2056: find_first_of(const _CharT* __s, size_type __pos, size_type __n) const; -: 2057: -: 2058: /** -: 2059: * @brief Find position of a character of C string. -: 2060: * @param __s String containing characters to locate. -: 2061: * @param __pos Index of character to search from (default 0). -: 2062: * @return Index of first occurrence. -: 2063: * -: 2064: * Starting from @a __pos, searches forward for one of the -: 2065: * characters of @a __s within this string. If found, returns -: 2066: * the index where it was found. If not found, returns npos. -: 2067: */ -: 2068: size_type -: 2069: find_first_of(const _CharT* __s, size_type __pos = 0) const -: 2070: { -: 2071: __glibcxx_requires_string(__s); -: 2072: return this->find_first_of(__s, __pos, traits_type::length(__s)); -: 2073: } -: 2074: -: 2075: /** -: 2076: * @brief Find position of a character. -: 2077: * @param __c Character to locate. -: 2078: * @param __pos Index of character to search from (default 0). -: 2079: * @return Index of first occurrence. -: 2080: * -: 2081: * Starting from @a __pos, searches forward for the character -: 2082: * @a __c within this string. If found, returns the index -: 2083: * where it was found. If not found, returns npos. -: 2084: * -: 2085: * Note: equivalent to find(__c, __pos). -: 2086: */ -: 2087: size_type -: 2088: find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT -: 2089: { return this->find(__c, __pos); } -: 2090: -: 2091: /** -: 2092: * @brief Find last position of a character of string. -: 2093: * @param __str String containing characters to locate. -: 2094: * @param __pos Index of character to search back from (default end). -: 2095: * @return Index of last occurrence. -: 2096: * -: 2097: * Starting from @a __pos, searches backward for one of the -: 2098: * characters of @a __str within this string. If found, -: 2099: * returns the index where it was found. If not found, returns -: 2100: * npos. -: 2101: */ -: 2102: size_type -: 2103: find_last_of(const basic_string& __str, size_type __pos = npos) const -: 2104: _GLIBCXX_NOEXCEPT -: 2105: { return this->find_last_of(__str.data(), __pos, __str.size()); } -: 2106: -: 2107: /** -: 2108: * @brief Find last position of a character of C substring. -: 2109: * @param __s C string containing characters to locate. -: 2110: * @param __pos Index of character to search back from. -: 2111: * @param __n Number of characters from s to search for. -: 2112: * @return Index of last occurrence. -: 2113: * -: 2114: * Starting from @a __pos, searches backward for one of the -: 2115: * first @a __n characters of @a __s within this string. If -: 2116: * found, returns the index where it was found. If not found, -: 2117: * returns npos. -: 2118: */ -: 2119: size_type -: 2120: find_last_of(const _CharT* __s, size_type __pos, size_type __n) const; -: 2121: -: 2122: /** -: 2123: * @brief Find last position of a character of C string. -: 2124: * @param __s C string containing characters to locate. -: 2125: * @param __pos Index of character to search back from (default end). -: 2126: * @return Index of last occurrence. -: 2127: * -: 2128: * Starting from @a __pos, searches backward for one of the -: 2129: * characters of @a __s within this string. If found, returns -: 2130: * the index where it was found. If not found, returns npos. -: 2131: */ -: 2132: size_type -: 2133: find_last_of(const _CharT* __s, size_type __pos = npos) const -: 2134: { -: 2135: __glibcxx_requires_string(__s); -: 2136: return this->find_last_of(__s, __pos, traits_type::length(__s)); -: 2137: } -: 2138: -: 2139: /** -: 2140: * @brief Find last position of a character. -: 2141: * @param __c Character to locate. -: 2142: * @param __pos Index of character to search back from (default end). -: 2143: * @return Index of last occurrence. -: 2144: * -: 2145: * Starting from @a __pos, searches backward for @a __c within -: 2146: * this string. If found, returns the index where it was -: 2147: * found. If not found, returns npos. -: 2148: * -: 2149: * Note: equivalent to rfind(__c, __pos). -: 2150: */ -: 2151: size_type -: 2152: find_last_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT -: 2153: { return this->rfind(__c, __pos); } -: 2154: -: 2155: /** -: 2156: * @brief Find position of a character not in string. -: 2157: * @param __str String containing characters to avoid. -: 2158: * @param __pos Index of character to search from (default 0). -: 2159: * @return Index of first occurrence. -: 2160: * -: 2161: * Starting from @a __pos, searches forward for a character not contained -: 2162: * in @a __str within this string. If found, returns the index where it -: 2163: * was found. If not found, returns npos. -: 2164: */ -: 2165: size_type -: 2166: find_first_not_of(const basic_string& __str, size_type __pos = 0) const -: 2167: _GLIBCXX_NOEXCEPT -: 2168: { return this->find_first_not_of(__str.data(), __pos, __str.size()); } -: 2169: -: 2170: /** -: 2171: * @brief Find position of a character not in C substring. -: 2172: * @param __s C string containing characters to avoid. -: 2173: * @param __pos Index of character to search from. -: 2174: * @param __n Number of characters from __s to consider. -: 2175: * @return Index of first occurrence. -: 2176: * -: 2177: * Starting from @a __pos, searches forward for a character not -: 2178: * contained in the first @a __n characters of @a __s within -: 2179: * this string. If found, returns the index where it was -: 2180: * found. If not found, returns npos. -: 2181: */ -: 2182: size_type -: 2183: find_first_not_of(const _CharT* __s, size_type __pos, -: 2184: size_type __n) const; -: 2185: -: 2186: /** -: 2187: * @brief Find position of a character not in C string. -: 2188: * @param __s C string containing characters to avoid. -: 2189: * @param __pos Index of character to search from (default 0). -: 2190: * @return Index of first occurrence. -: 2191: * -: 2192: * Starting from @a __pos, searches forward for a character not -: 2193: * contained in @a __s within this string. If found, returns -: 2194: * the index where it was found. If not found, returns npos. -: 2195: */ -: 2196: size_type -: 2197: find_first_not_of(const _CharT* __s, size_type __pos = 0) const -: 2198: { -: 2199: __glibcxx_requires_string(__s); -: 2200: return this->find_first_not_of(__s, __pos, traits_type::length(__s)); -: 2201: } -: 2202: -: 2203: /** -: 2204: * @brief Find position of a different character. -: 2205: * @param __c Character to avoid. -: 2206: * @param __pos Index of character to search from (default 0). -: 2207: * @return Index of first occurrence. -: 2208: * -: 2209: * Starting from @a __pos, searches forward for a character -: 2210: * other than @a __c within this string. If found, returns the -: 2211: * index where it was found. If not found, returns npos. -: 2212: */ -: 2213: size_type -: 2214: find_first_not_of(_CharT __c, size_type __pos = 0) const -: 2215: _GLIBCXX_NOEXCEPT; -: 2216: -: 2217: /** -: 2218: * @brief Find last position of a character not in string. -: 2219: * @param __str String containing characters to avoid. -: 2220: * @param __pos Index of character to search back from (default end). -: 2221: * @return Index of last occurrence. -: 2222: * -: 2223: * Starting from @a __pos, searches backward for a character -: 2224: * not contained in @a __str within this string. If found, -: 2225: * returns the index where it was found. If not found, returns -: 2226: * npos. -: 2227: */ -: 2228: size_type -: 2229: find_last_not_of(const basic_string& __str, size_type __pos = npos) const -: 2230: _GLIBCXX_NOEXCEPT -: 2231: { return this->find_last_not_of(__str.data(), __pos, __str.size()); } -: 2232: -: 2233: /** -: 2234: * @brief Find last position of a character not in C substring. -: 2235: * @param __s C string containing characters to avoid. -: 2236: * @param __pos Index of character to search back from. -: 2237: * @param __n Number of characters from s to consider. -: 2238: * @return Index of last occurrence. -: 2239: * -: 2240: * Starting from @a __pos, searches backward for a character not -: 2241: * contained in the first @a __n characters of @a __s within this string. -: 2242: * If found, returns the index where it was found. If not found, -: 2243: * returns npos. -: 2244: */ -: 2245: size_type -: 2246: find_last_not_of(const _CharT* __s, size_type __pos, -: 2247: size_type __n) const; -: 2248: /** -: 2249: * @brief Find last position of a character not in C string. -: 2250: * @param __s C string containing characters to avoid. -: 2251: * @param __pos Index of character to search back from (default end). -: 2252: * @return Index of last occurrence. -: 2253: * -: 2254: * Starting from @a __pos, searches backward for a character -: 2255: * not contained in @a __s within this string. If found, -: 2256: * returns the index where it was found. If not found, returns -: 2257: * npos. -: 2258: */ -: 2259: size_type -: 2260: find_last_not_of(const _CharT* __s, size_type __pos = npos) const -: 2261: { -: 2262: __glibcxx_requires_string(__s); -: 2263: return this->find_last_not_of(__s, __pos, traits_type::length(__s)); -: 2264: } -: 2265: -: 2266: /** -: 2267: * @brief Find last position of a different character. -: 2268: * @param __c Character to avoid. -: 2269: * @param __pos Index of character to search back from (default end). -: 2270: * @return Index of last occurrence. -: 2271: * -: 2272: * Starting from @a __pos, searches backward for a character other than -: 2273: * @a __c within this string. If found, returns the index where it was -: 2274: * found. If not found, returns npos. -: 2275: */ -: 2276: size_type -: 2277: find_last_not_of(_CharT __c, size_type __pos = npos) const -: 2278: _GLIBCXX_NOEXCEPT; -: 2279: -: 2280: /** -: 2281: * @brief Get a substring. -: 2282: * @param __pos Index of first character (default 0). -: 2283: * @param __n Number of characters in substring (default remainder). -: 2284: * @return The new string. -: 2285: * @throw std::out_of_range If __pos > size(). -: 2286: * -: 2287: * Construct and return a new string using the @a __n -: 2288: * characters starting at @a __pos. If the string is too -: 2289: * short, use the remainder of the characters. If @a __pos is -: 2290: * beyond the end of the string, out_of_range is thrown. -: 2291: */ -: 2292: basic_string -: 2293: substr(size_type __pos = 0, size_type __n = npos) const -: 2294: { return basic_string(*this, -: 2295: _M_check(__pos, "basic_string::substr"), __n); } -: 2296: -: 2297: /** -: 2298: * @brief Compare to a string. -: 2299: * @param __str String to compare against. -: 2300: * @return Integer < 0, 0, or > 0. -: 2301: * -: 2302: * Returns an integer < 0 if this string is ordered before @a -: 2303: * __str, 0 if their values are equivalent, or > 0 if this -: 2304: * string is ordered after @a __str. Determines the effective -: 2305: * length rlen of the strings to compare as the smallest of -: 2306: * size() and str.size(). The function then compares the two -: 2307: * strings by calling traits::compare(data(), str.data(),rlen). -: 2308: * If the result of the comparison is nonzero returns it, -: 2309: * otherwise the shorter one is ordered first. -: 2310: */ -: 2311: int -: 2312: compare(const basic_string& __str) const -: 2313: { -: 2314: const size_type __size = this->size(); -: 2315: const size_type __osize = __str.size(); -: 2316: const size_type __len = std::min(__size, __osize); -: 2317: -: 2318: int __r = traits_type::compare(_M_data(), __str.data(), __len); -: 2319: if (!__r) -: 2320: __r = _S_compare(__size, __osize); -: 2321: return __r; -: 2322: } -: 2323: -: 2324: /** -: 2325: * @brief Compare substring to a string. -: 2326: * @param __pos Index of first character of substring. -: 2327: * @param __n Number of characters in substring. -: 2328: * @param __str String to compare against. -: 2329: * @return Integer < 0, 0, or > 0. -: 2330: * -: 2331: * Form the substring of this string from the @a __n characters -: 2332: * starting at @a __pos. Returns an integer < 0 if the -: 2333: * substring is ordered before @a __str, 0 if their values are -: 2334: * equivalent, or > 0 if the substring is ordered after @a -: 2335: * __str. Determines the effective length rlen of the strings -: 2336: * to compare as the smallest of the length of the substring -: 2337: * and @a __str.size(). The function then compares the two -: 2338: * strings by calling -: 2339: * traits::compare(substring.data(),str.data(),rlen). If the -: 2340: * result of the comparison is nonzero returns it, otherwise -: 2341: * the shorter one is ordered first. -: 2342: */ -: 2343: int -: 2344: compare(size_type __pos, size_type __n, const basic_string& __str) const; -: 2345: -: 2346: /** -: 2347: * @brief Compare substring to a substring. -: 2348: * @param __pos1 Index of first character of substring. -: 2349: * @param __n1 Number of characters in substring. -: 2350: * @param __str String to compare against. -: 2351: * @param __pos2 Index of first character of substring of str. -: 2352: * @param __n2 Number of characters in substring of str. -: 2353: * @return Integer < 0, 0, or > 0. -: 2354: * -: 2355: * Form the substring of this string from the @a __n1 -: 2356: * characters starting at @a __pos1. Form the substring of @a -: 2357: * __str from the @a __n2 characters starting at @a __pos2. -: 2358: * Returns an integer < 0 if this substring is ordered before -: 2359: * the substring of @a __str, 0 if their values are equivalent, -: 2360: * or > 0 if this substring is ordered after the substring of -: 2361: * @a __str. Determines the effective length rlen of the -: 2362: * strings to compare as the smallest of the lengths of the -: 2363: * substrings. The function then compares the two strings by -: 2364: * calling -: 2365: * traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen). -: 2366: * If the result of the comparison is nonzero returns it, -: 2367: * otherwise the shorter one is ordered first. -: 2368: */ -: 2369: int -: 2370: compare(size_type __pos1, size_type __n1, const basic_string& __str, -: 2371: size_type __pos2, size_type __n2) const; -: 2372: -: 2373: /** -: 2374: * @brief Compare to a C string. -: 2375: * @param __s C string to compare against. -: 2376: * @return Integer < 0, 0, or > 0. -: 2377: * -: 2378: * Returns an integer < 0 if this string is ordered before @a __s, 0 if -: 2379: * their values are equivalent, or > 0 if this string is ordered after -: 2380: * @a __s. Determines the effective length rlen of the strings to -: 2381: * compare as the smallest of size() and the length of a string -: 2382: * constructed from @a __s. The function then compares the two strings -: 2383: * by calling traits::compare(data(),s,rlen). If the result of the -: 2384: * comparison is nonzero returns it, otherwise the shorter one is -: 2385: * ordered first. -: 2386: */ -: 2387: int -: 2388: compare(const _CharT* __s) const; -: 2389: -: 2390: // _GLIBCXX_RESOLVE_LIB_DEFECTS -: 2391: // 5 String::compare specification questionable -: 2392: /** -: 2393: * @brief Compare substring to a C string. -: 2394: * @param __pos Index of first character of substring. -: 2395: * @param __n1 Number of characters in substring. -: 2396: * @param __s C string to compare against. -: 2397: * @return Integer < 0, 0, or > 0. -: 2398: * -: 2399: * Form the substring of this string from the @a __n1 -: 2400: * characters starting at @a pos. Returns an integer < 0 if -: 2401: * the substring is ordered before @a __s, 0 if their values -: 2402: * are equivalent, or > 0 if the substring is ordered after @a -: 2403: * __s. Determines the effective length rlen of the strings to -: 2404: * compare as the smallest of the length of the substring and -: 2405: * the length of a string constructed from @a __s. The -: 2406: * function then compares the two string by calling -: 2407: * traits::compare(substring.data(),__s,rlen). If the result of -: 2408: * the comparison is nonzero returns it, otherwise the shorter -: 2409: * one is ordered first. -: 2410: */ -: 2411: int -: 2412: compare(size_type __pos, size_type __n1, const _CharT* __s) const; -: 2413: -: 2414: /** -: 2415: * @brief Compare substring against a character %array. -: 2416: * @param __pos Index of first character of substring. -: 2417: * @param __n1 Number of characters in substring. -: 2418: * @param __s character %array to compare against. -: 2419: * @param __n2 Number of characters of s. -: 2420: * @return Integer < 0, 0, or > 0. -: 2421: * -: 2422: * Form the substring of this string from the @a __n1 -: 2423: * characters starting at @a __pos. Form a string from the -: 2424: * first @a __n2 characters of @a __s. Returns an integer < 0 -: 2425: * if this substring is ordered before the string from @a __s, -: 2426: * 0 if their values are equivalent, or > 0 if this substring -: 2427: * is ordered after the string from @a __s. Determines the -: 2428: * effective length rlen of the strings to compare as the -: 2429: * smallest of the length of the substring and @a __n2. The -: 2430: * function then compares the two strings by calling -: 2431: * traits::compare(substring.data(),s,rlen). If the result of -: 2432: * the comparison is nonzero returns it, otherwise the shorter -: 2433: * one is ordered first. -: 2434: * -: 2435: * NB: s must have at least n2 characters, '\\0' has -: 2436: * no special meaning. -: 2437: */ -: 2438: int -: 2439: compare(size_type __pos, size_type __n1, const _CharT* __s, -: 2440: size_type __n2) const; -: 2441: }; -: 2442:_GLIBCXX_END_NAMESPACE_CXX11 -: 2443:#else // !_GLIBCXX_USE_CXX11_ABI -: 2444: // Reference-counted COW string implentation -: 2445: -: 2446: /** -: 2447: * @class basic_string basic_string.h -: 2448: * @brief Managing sequences of characters and character-like objects. -: 2449: * -: 2450: * @ingroup strings -: 2451: * @ingroup sequences -: 2452: * -: 2453: * @tparam _CharT Type of character -: 2454: * @tparam _Traits Traits for character type, defaults to -: 2455: * char_traits<_CharT>. -: 2456: * @tparam _Alloc Allocator type, defaults to allocator<_CharT>. -: 2457: * -: 2458: * Meets the requirements of a container, a -: 2459: * reversible container, and a -: 2460: * sequence. Of the -: 2461: * optional sequence requirements, only -: 2462: * @c push_back, @c at, and @c %array access are supported. -: 2463: * -: 2464: * @doctodo -: 2465: * -: 2466: * -: 2467: * Documentation? What's that? -: 2468: * Nathan Myers . -: 2469: * -: 2470: * A string looks like this: -: 2471: * -: 2472: * @code -: 2473: * [_Rep] -: 2474: * _M_length -: 2475: * [basic_string] _M_capacity -: 2476: * _M_dataplus _M_refcount -: 2477: * _M_p ----------------> unnamed array of char_type -: 2478: * @endcode -: 2479: * -: 2480: * Where the _M_p points to the first character in the string, and -: 2481: * you cast it to a pointer-to-_Rep and subtract 1 to get a -: 2482: * pointer to the header. -: 2483: * -: 2484: * This approach has the enormous advantage that a string object -: 2485: * requires only one allocation. All the ugliness is confined -: 2486: * within a single %pair of inline functions, which each compile to -: 2487: * a single @a add instruction: _Rep::_M_data(), and -: 2488: * string::_M_rep(); and the allocation function which gets a -: 2489: * block of raw bytes and with room enough and constructs a _Rep -: 2490: * object at the front. -: 2491: * -: 2492: * The reason you want _M_data pointing to the character %array and -: 2493: * not the _Rep is so that the debugger can see the string -: 2494: * contents. (Probably we should add a non-inline member to get -: 2495: * the _Rep for the debugger to use, so users can check the actual -: 2496: * string length.) -: 2497: * -: 2498: * Note that the _Rep object is a POD so that you can have a -: 2499: * static empty string _Rep object already @a constructed before -: 2500: * static constructors have run. The reference-count encoding is -: 2501: * chosen so that a 0 indicates one reference, so you never try to -: 2502: * destroy the empty-string _Rep object. -: 2503: * -: 2504: * All but the last paragraph is considered pretty conventional -: 2505: * for a C++ string implementation. -: 2506: */ -: 2507: // 21.3 Template class basic_string -: 2508: template -: 2509: class basic_string -: 2510: { -: 2511: typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type; -: 2512: -: 2513: // Types: -: 2514: public: -: 2515: typedef _Traits traits_type; -: 2516: typedef typename _Traits::char_type value_type; -: 2517: typedef _Alloc allocator_type; -: 2518: typedef typename _CharT_alloc_type::size_type size_type; -: 2519: typedef typename _CharT_alloc_type::difference_type difference_type; -: 2520: typedef typename _CharT_alloc_type::reference reference; -: 2521: typedef typename _CharT_alloc_type::const_reference const_reference; -: 2522: typedef typename _CharT_alloc_type::pointer pointer; -: 2523: typedef typename _CharT_alloc_type::const_pointer const_pointer; -: 2524: typedef __gnu_cxx::__normal_iterator iterator; -: 2525: typedef __gnu_cxx::__normal_iterator -: 2526: const_iterator; -: 2527: typedef std::reverse_iterator const_reverse_iterator; -: 2528: typedef std::reverse_iterator reverse_iterator; -: 2529: -: 2530: private: -: 2531: // _Rep: string representation -: 2532: // Invariants: -: 2533: // 1. String really contains _M_length + 1 characters: due to 21.3.4 -: 2534: // must be kept null-terminated. -: 2535: // 2. _M_capacity >= _M_length -: 2536: // Allocated memory is always (_M_capacity + 1) * sizeof(_CharT). -: 2537: // 3. _M_refcount has three states: -: 2538: // -1: leaked, one reference, no ref-copies allowed, non-const. -: 2539: // 0: one reference, non-const. -: 2540: // n>0: n + 1 references, operations require a lock, const. -: 2541: // 4. All fields==0 is an empty string, given the extra storage -: 2542: // beyond-the-end for a null terminator; thus, the shared -: 2543: // empty string representation needs no constructor. -: 2544: -: 2545: struct _Rep_base -: 2546: { -: 2547: size_type _M_length; -: 2548: size_type _M_capacity; -: 2549: _Atomic_word _M_refcount; -: 2550: }; -: 2551: -: 2552: struct _Rep : _Rep_base -: 2553: { -: 2554: // Types: -: 2555: typedef typename _Alloc::template rebind::other _Raw_bytes_alloc; -: 2556: -: 2557: // (Public) Data members: -: 2558: -: 2559: // The maximum number of individual char_type elements of an -: 2560: // individual string is determined by _S_max_size. This is the -: 2561: // value that will be returned by max_size(). (Whereas npos -: 2562: // is the maximum number of bytes the allocator can allocate.) -: 2563: // If one was to divvy up the theoretical largest size string, -: 2564: // with a terminating character and m _CharT elements, it'd -: 2565: // look like this: -: 2566: // npos = sizeof(_Rep) + (m * sizeof(_CharT)) + sizeof(_CharT) -: 2567: // Solving for m: -: 2568: // m = ((npos - sizeof(_Rep))/sizeof(CharT)) - 1 -: 2569: // In addition, this implementation quarters this amount. -: 2570: static const size_type _S_max_size; -: 2571: static const _CharT _S_terminal; -: 2572: -: 2573: // The following storage is init'd to 0 by the linker, resulting -: 2574: // (carefully) in an empty string with one reference. -: 2575: static size_type _S_empty_rep_storage[]; -: 2576: -: 2577: static _Rep& -: 2578: _S_empty_rep() _GLIBCXX_NOEXCEPT -: 2579: { -: 2580: // NB: Mild hack to avoid strict-aliasing warnings. Note that -: 2581: // _S_empty_rep_storage is never modified and the punning should -: 2582: // be reasonably safe in this case. -: 2583: void* __p = reinterpret_cast(&_S_empty_rep_storage); -: 2584: return *reinterpret_cast<_Rep*>(__p); -: 2585: } -: 2586: -: 2587: bool -: 2588: _M_is_leaked() const _GLIBCXX_NOEXCEPT -: 2589: { return this->_M_refcount < 0; } -: 2590: -: 2591: bool -: 2592: _M_is_shared() const _GLIBCXX_NOEXCEPT -: 2593: { return this->_M_refcount > 0; } -: 2594: -: 2595: void -: 2596: _M_set_leaked() _GLIBCXX_NOEXCEPT -: 2597: { this->_M_refcount = -1; } -: 2598: -: 2599: void -: 2600: _M_set_sharable() _GLIBCXX_NOEXCEPT -: 2601: { this->_M_refcount = 0; } -: 2602: -: 2603: void -: 2604: _M_set_length_and_sharable(size_type __n) _GLIBCXX_NOEXCEPT -: 2605: { -: 2606:#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 -: 2607: if (__builtin_expect(this != &_S_empty_rep(), false)) -: 2608:#endif -: 2609: { -: 2610: this->_M_set_sharable(); // One reference. -: 2611: this->_M_length = __n; -: 2612: traits_type::assign(this->_M_refdata()[__n], _S_terminal); -: 2613: // grrr. (per 21.3.4) -: 2614: // You cannot leave those LWG people alone for a second. -: 2615: } -: 2616: } -: 2617: -: 2618: _CharT* -: 2619: _M_refdata() throw() -: 2620: { return reinterpret_cast<_CharT*>(this + 1); } -: 2621: -: 2622: _CharT* -: 2623: _M_grab(const _Alloc& __alloc1, const _Alloc& __alloc2) -: 2624: { -: 2625: return (!_M_is_leaked() && __alloc1 == __alloc2) -: 2626: ? _M_refcopy() : _M_clone(__alloc1); -: 2627: } -: 2628: -: 2629: // Create & Destroy -: 2630: static _Rep* -: 2631: _S_create(size_type, size_type, const _Alloc&); -: 2632: -: 2633: void -: 2634: _M_dispose(const _Alloc& __a) _GLIBCXX_NOEXCEPT -: 2635: { -: 2636:#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 -: 2637: if (__builtin_expect(this != &_S_empty_rep(), false)) -: 2638:#endif -: 2639: { -: 2640: // Be race-detector-friendly. For more info see bits/c++config. -: 2641: _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount); -: 2642: if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -: 2643: -1) <= 0) -: 2644: { -: 2645: _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount); -: 2646: _M_destroy(__a); -: 2647: } -: 2648: } -: 2649: } // XXX MT -: 2650: -: 2651: void -: 2652: _M_destroy(const _Alloc&) throw(); -: 2653: -: 2654: _CharT* -: 2655: _M_refcopy() throw() -: 2656: { -: 2657:#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 -: 2658: if (__builtin_expect(this != &_S_empty_rep(), false)) -: 2659:#endif -: 2660: __gnu_cxx::__atomic_add_dispatch(&this->_M_refcount, 1); -: 2661: return _M_refdata(); -: 2662: } // XXX MT -: 2663: -: 2664: _CharT* -: 2665: _M_clone(const _Alloc&, size_type __res = 0); -: 2666: }; -: 2667: -: 2668: // Use empty-base optimization: http://www.cantrip.org/emptyopt.html -: 2669: struct _Alloc_hider : _Alloc -: 2670: { -: 2671: _Alloc_hider(_CharT* __dat, const _Alloc& __a) _GLIBCXX_NOEXCEPT -: 2672: : _Alloc(__a), _M_p(__dat) { } -: 2673: -: 2674: _CharT* _M_p; // The actual data. -: 2675: }; -: 2676: -: 2677: public: -: 2678: // Data Members (public): -: 2679: // NB: This is an unsigned type, and thus represents the maximum -: 2680: // size that the allocator can hold. -: 2681: /// Value returned by various member functions when they fail. -: 2682: static const size_type npos = static_cast(-1); -: 2683: -: 2684: private: -: 2685: // Data Members (private): -: 2686: mutable _Alloc_hider _M_dataplus; -: 2687: -: 2688: _CharT* -: 2689: _M_data() const _GLIBCXX_NOEXCEPT -: 2690: { return _M_dataplus._M_p; } -: 2691: -: 2692: _CharT* -: 2693: _M_data(_CharT* __p) _GLIBCXX_NOEXCEPT -: 2694: { return (_M_dataplus._M_p = __p); } -: 2695: -: 2696: _Rep* -: 2697: _M_rep() const _GLIBCXX_NOEXCEPT -: 2698: { return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); } -: 2699: -: 2700: // For the internal use we have functions similar to `begin'/`end' -: 2701: // but they do not call _M_leak. -: 2702: iterator -: 2703: _M_ibegin() const _GLIBCXX_NOEXCEPT -: 2704: { return iterator(_M_data()); } -: 2705: -: 2706: iterator -: 2707: _M_iend() const _GLIBCXX_NOEXCEPT -: 2708: { return iterator(_M_data() + this->size()); } -: 2709: -: 2710: void -: 2711: _M_leak() // for use in begin() & non-const op[] -: 2712: { -: 2713: if (!_M_rep()->_M_is_leaked()) -: 2714: _M_leak_hard(); -: 2715: } -: 2716: -: 2717: size_type -: 2718: _M_check(size_type __pos, const char* __s) const -: 2719: { -: 2720: if (__pos > this->size()) -: 2721: __throw_out_of_range_fmt(__N("%s: __pos (which is %zu) > " -: 2722: "this->size() (which is %zu)"), -: 2723: __s, __pos, this->size()); -: 2724: return __pos; -: 2725: } -: 2726: -: 2727: void -: 2728: _M_check_length(size_type __n1, size_type __n2, const char* __s) const -: 2729: { -: 2730: if (this->max_size() - (this->size() - __n1) < __n2) -: 2731: __throw_length_error(__N(__s)); -: 2732: } -: 2733: -: 2734: // NB: _M_limit doesn't check for a bad __pos value. -: 2735: size_type -: 2736: _M_limit(size_type __pos, size_type __off) const _GLIBCXX_NOEXCEPT -: 2737: { -: 2738: const bool __testoff = __off < this->size() - __pos; -: 2739: return __testoff ? __off : this->size() - __pos; -: 2740: } -: 2741: -: 2742: // True if _Rep and source do not overlap. -: 2743: bool -: 2744: _M_disjunct(const _CharT* __s) const _GLIBCXX_NOEXCEPT -: 2745: { -: 2746: return (less()(__s, _M_data()) -: 2747: || less()(_M_data() + this->size(), __s)); -: 2748: } -: 2749: -: 2750: // When __n = 1 way faster than the general multichar -: 2751: // traits_type::copy/move/assign. -: 2752: static void -: 2753: _M_copy(_CharT* __d, const _CharT* __s, size_type __n) _GLIBCXX_NOEXCEPT -: 2754: { -: 2755: if (__n == 1) -: 2756: traits_type::assign(*__d, *__s); -: 2757: else -: 2758: traits_type::copy(__d, __s, __n); -: 2759: } -: 2760: -: 2761: static void -: 2762: _M_move(_CharT* __d, const _CharT* __s, size_type __n) _GLIBCXX_NOEXCEPT -: 2763: { -: 2764: if (__n == 1) -: 2765: traits_type::assign(*__d, *__s); -: 2766: else -: 2767: traits_type::move(__d, __s, __n); -: 2768: } -: 2769: -: 2770: static void -: 2771: _M_assign(_CharT* __d, size_type __n, _CharT __c) _GLIBCXX_NOEXCEPT -: 2772: { -: 2773: if (__n == 1) -: 2774: traits_type::assign(*__d, __c); -: 2775: else -: 2776: traits_type::assign(__d, __n, __c); -: 2777: } -: 2778: -: 2779: // _S_copy_chars is a separate template to permit specialization -: 2780: // to optimize for the common case of pointers as iterators. -: 2781: template -: 2782: static void -: 2783: _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2) -: 2784: { -: 2785: for (; __k1 != __k2; ++__k1, ++__p) -: 2786: traits_type::assign(*__p, *__k1); // These types are off. -: 2787: } -: 2788: -: 2789: static void -: 2790: _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) _GLIBCXX_NOEXCEPT -: 2791: { _S_copy_chars(__p, __k1.base(), __k2.base()); } -: 2792: -: 2793: static void -: 2794: _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2) -: 2795: _GLIBCXX_NOEXCEPT -: 2796: { _S_copy_chars(__p, __k1.base(), __k2.base()); } -: 2797: -: 2798: static void -: 2799: _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) _GLIBCXX_NOEXCEPT -: 2800: { _M_copy(__p, __k1, __k2 - __k1); } -: 2801: -: 2802: static void -: 2803: _S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2) -: 2804: _GLIBCXX_NOEXCEPT -: 2805: { _M_copy(__p, __k1, __k2 - __k1); } -: 2806: -: 2807: static int -: 2808: _S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT -: 2809: { -: 2810: const difference_type __d = difference_type(__n1 - __n2); -: 2811: -: 2812: if (__d > __gnu_cxx::__numeric_traits::__max) -: 2813: return __gnu_cxx::__numeric_traits::__max; -: 2814: else if (__d < __gnu_cxx::__numeric_traits::__min) -: 2815: return __gnu_cxx::__numeric_traits::__min; -: 2816: else -: 2817: return int(__d); -: 2818: } -: 2819: -: 2820: void -: 2821: _M_mutate(size_type __pos, size_type __len1, size_type __len2); -: 2822: -: 2823: void -: 2824: _M_leak_hard(); -: 2825: -: 2826: static _Rep& -: 2827: _S_empty_rep() _GLIBCXX_NOEXCEPT -: 2828: { return _Rep::_S_empty_rep(); } -: 2829: -: 2830: public: -: 2831: // Construct/copy/destroy: -: 2832: // NB: We overload ctors in some cases instead of using default -: 2833: // arguments, per 17.4.4.4 para. 2 item 2. -: 2834: -: 2835: /** -: 2836: * @brief Default constructor creates an empty string. -: 2837: */ -: 2838: basic_string() -: 2839:#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 -: 2840: : _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { } -: 2841:#else -: 2842: : _M_dataplus(_S_construct(size_type(), _CharT(), _Alloc()), _Alloc()){ } -: 2843:#endif -: 2844: -: 2845: /** -: 2846: * @brief Construct an empty string using allocator @a a. -: 2847: */ -: 2848: explicit -: 2849: basic_string(const _Alloc& __a); -: 2850: -: 2851: // NB: per LWG issue 42, semantics different from IS: -: 2852: /** -: 2853: * @brief Construct string with copy of value of @a str. -: 2854: * @param __str Source string. -: 2855: */ -: 2856: basic_string(const basic_string& __str); -: 2857: /** -: 2858: * @brief Construct string as copy of a substring. -: 2859: * @param __str Source string. -: 2860: * @param __pos Index of first character to copy from. -: 2861: * @param __n Number of characters to copy (default remainder). -: 2862: */ -: 2863: basic_string(const basic_string& __str, size_type __pos, -: 2864: size_type __n = npos); -: 2865: /** -: 2866: * @brief Construct string as copy of a substring. -: 2867: * @param __str Source string. -: 2868: * @param __pos Index of first character to copy from. -: 2869: * @param __n Number of characters to copy. -: 2870: * @param __a Allocator to use. -: 2871: */ -: 2872: basic_string(const basic_string& __str, size_type __pos, -: 2873: size_type __n, const _Alloc& __a); -: 2874: -: 2875: /** -: 2876: * @brief Construct string initialized by a character %array. -: 2877: * @param __s Source character %array. -: 2878: * @param __n Number of characters to copy. -: 2879: * @param __a Allocator to use (default is default allocator). -: 2880: * -: 2881: * NB: @a __s must have at least @a __n characters, '\\0' -: 2882: * has no special meaning. -: 2883: */ -: 2884: basic_string(const _CharT* __s, size_type __n, -: 2885: const _Alloc& __a = _Alloc()); -: 2886: /** -: 2887: * @brief Construct string as copy of a C string. -: 2888: * @param __s Source C string. -: 2889: * @param __a Allocator to use (default is default allocator). -: 2890: */ -: 2891: basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()); -: 2892: /** -: 2893: * @brief Construct string as multiple characters. -: 2894: * @param __n Number of characters. -: 2895: * @param __c Character to use. -: 2896: * @param __a Allocator to use (default is default allocator). -: 2897: */ -: 2898: basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()); -: 2899: -: 2900:#if __cplusplus >= 201103L -: 2901: /** -: 2902: * @brief Move construct string. -: 2903: * @param __str Source string. -: 2904: * -: 2905: * The newly-created string contains the exact contents of @a __str. -: 2906: * @a __str is a valid, but unspecified string. -: 2907: **/ -: 2908: basic_string(basic_string&& __str) -: 2909:#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 -: 2910: noexcept // FIXME C++11: should always be noexcept. -: 2911:#endif -: 2912: : _M_dataplus(__str._M_dataplus) -: 2913: { -: 2914:#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 -: 2915: __str._M_data(_S_empty_rep()._M_refdata()); -: 2916:#else -: 2917: __str._M_data(_S_construct(size_type(), _CharT(), get_allocator())); -: 2918:#endif -: 2919: } -: 2920: -: 2921: /** -: 2922: * @brief Construct string from an initializer %list. -: 2923: * @param __l std::initializer_list of characters. -: 2924: * @param __a Allocator to use (default is default allocator). -: 2925: */ -: 2926: basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()); -: 2927:#endif // C++11 -: 2928: -: 2929: /** -: 2930: * @brief Construct string as copy of a range. -: 2931: * @param __beg Start of range. -: 2932: * @param __end End of range. -: 2933: * @param __a Allocator to use (default is default allocator). -: 2934: */ -: 2935: template -: 2936: basic_string(_InputIterator __beg, _InputIterator __end, -: 2937: const _Alloc& __a = _Alloc()); -: 2938: -: 2939: /** -: 2940: * @brief Destroy the string instance. -: 2941: */ -: 2942: ~basic_string() _GLIBCXX_NOEXCEPT -: 2943: { _M_rep()->_M_dispose(this->get_allocator()); } -: 2944: -: 2945: /** -: 2946: * @brief Assign the value of @a str to this string. -: 2947: * @param __str Source string. -: 2948: */ -: 2949: basic_string& -: 2950: operator=(const basic_string& __str) -: 2951: { return this->assign(__str); } -: 2952: -: 2953: /** -: 2954: * @brief Copy contents of @a s into this string. -: 2955: * @param __s Source null-terminated string. -: 2956: */ -: 2957: basic_string& -: 2958: operator=(const _CharT* __s) -: 2959: { return this->assign(__s); } -: 2960: -: 2961: /** -: 2962: * @brief Set value to string of length 1. -: 2963: * @param __c Source character. -: 2964: * -: 2965: * Assigning to a character makes this string length 1 and -: 2966: * (*this)[0] == @a c. -: 2967: */ -: 2968: basic_string& -: 2969: operator=(_CharT __c) -: 2970: { -: 2971: this->assign(1, __c); -: 2972: return *this; -: 2973: } -: 2974: -: 2975:#if __cplusplus >= 201103L -: 2976: /** -: 2977: * @brief Move assign the value of @a str to this string. -: 2978: * @param __str Source string. -: 2979: * -: 2980: * The contents of @a str are moved into this string (without copying). -: 2981: * @a str is a valid, but unspecified string. -: 2982: **/ -: 2983: // PR 58265, this should be noexcept. -: 2984: basic_string& -: 2985: operator=(basic_string&& __str) -: 2986: { -: 2987: // NB: DR 1204. -: 2988: this->swap(__str); -: 2989: return *this; -: 2990: } -: 2991: -: 2992: /** -: 2993: * @brief Set value to string constructed from initializer %list. -: 2994: * @param __l std::initializer_list. -: 2995: */ -: 2996: basic_string& -: 2997: operator=(initializer_list<_CharT> __l) -: 2998: { -: 2999: this->assign(__l.begin(), __l.size()); -: 3000: return *this; -: 3001: } -: 3002:#endif // C++11 -: 3003: -: 3004: // Iterators: -: 3005: /** -: 3006: * Returns a read/write iterator that points to the first character in -: 3007: * the %string. Unshares the string. -: 3008: */ -: 3009: iterator -: 3010: begin() // FIXME C++11: should be noexcept. -: 3011: { -: 3012: _M_leak(); -: 3013: return iterator(_M_data()); -: 3014: } -: 3015: -: 3016: /** -: 3017: * Returns a read-only (constant) iterator that points to the first -: 3018: * character in the %string. -: 3019: */ -: 3020: const_iterator -: 3021: begin() const _GLIBCXX_NOEXCEPT -: 3022: { return const_iterator(_M_data()); } -: 3023: -: 3024: /** -: 3025: * Returns a read/write iterator that points one past the last -: 3026: * character in the %string. Unshares the string. -: 3027: */ -: 3028: iterator -: 3029: end() // FIXME C++11: should be noexcept. -: 3030: { -: 3031: _M_leak(); -: 3032: return iterator(_M_data() + this->size()); -: 3033: } -: 3034: -: 3035: /** -: 3036: * Returns a read-only (constant) iterator that points one past the -: 3037: * last character in the %string. -: 3038: */ -: 3039: const_iterator -: 3040: end() const _GLIBCXX_NOEXCEPT -: 3041: { return const_iterator(_M_data() + this->size()); } -: 3042: -: 3043: /** -: 3044: * Returns a read/write reverse iterator that points to the last -: 3045: * character in the %string. Iteration is done in reverse element -: 3046: * order. Unshares the string. -: 3047: */ -: 3048: reverse_iterator -: 3049: rbegin() // FIXME C++11: should be noexcept. -: 3050: { return reverse_iterator(this->end()); } -: 3051: -: 3052: /** -: 3053: * Returns a read-only (constant) reverse iterator that points -: 3054: * to the last character in the %string. Iteration is done in -: 3055: * reverse element order. -: 3056: */ -: 3057: const_reverse_iterator -: 3058: rbegin() const _GLIBCXX_NOEXCEPT -: 3059: { return const_reverse_iterator(this->end()); } -: 3060: -: 3061: /** -: 3062: * Returns a read/write reverse iterator that points to one before the -: 3063: * first character in the %string. Iteration is done in reverse -: 3064: * element order. Unshares the string. -: 3065: */ -: 3066: reverse_iterator -: 3067: rend() // FIXME C++11: should be noexcept. -: 3068: { return reverse_iterator(this->begin()); } -: 3069: -: 3070: /** -: 3071: * Returns a read-only (constant) reverse iterator that points -: 3072: * to one before the first character in the %string. Iteration -: 3073: * is done in reverse element order. -: 3074: */ -: 3075: const_reverse_iterator -: 3076: rend() const _GLIBCXX_NOEXCEPT -: 3077: { return const_reverse_iterator(this->begin()); } -: 3078: -: 3079:#if __cplusplus >= 201103L -: 3080: /** -: 3081: * Returns a read-only (constant) iterator that points to the first -: 3082: * character in the %string. -: 3083: */ -: 3084: const_iterator -: 3085: cbegin() const noexcept -: 3086: { return const_iterator(this->_M_data()); } -: 3087: -: 3088: /** -: 3089: * Returns a read-only (constant) iterator that points one past the -: 3090: * last character in the %string. -: 3091: */ -: 3092: const_iterator -: 3093: cend() const noexcept -: 3094: { return const_iterator(this->_M_data() + this->size()); } -: 3095: -: 3096: /** -: 3097: * Returns a read-only (constant) reverse iterator that points -: 3098: * to the last character in the %string. Iteration is done in -: 3099: * reverse element order. -: 3100: */ -: 3101: const_reverse_iterator -: 3102: crbegin() const noexcept -: 3103: { return const_reverse_iterator(this->end()); } -: 3104: -: 3105: /** -: 3106: * Returns a read-only (constant) reverse iterator that points -: 3107: * to one before the first character in the %string. Iteration -: 3108: * is done in reverse element order. -: 3109: */ -: 3110: const_reverse_iterator -: 3111: crend() const noexcept -: 3112: { return const_reverse_iterator(this->begin()); } -: 3113:#endif -: 3114: -: 3115: public: -: 3116: // Capacity: -: 3117: /// Returns the number of characters in the string, not including any -: 3118: /// null-termination. -: 3119: size_type -: 3120: size() const _GLIBCXX_NOEXCEPT -: 3121: { return _M_rep()->_M_length; } -: 3122: -: 3123: /// Returns the number of characters in the string, not including any -: 3124: /// null-termination. -: 3125: size_type -: 3126: length() const _GLIBCXX_NOEXCEPT -: 3127: { return _M_rep()->_M_length; } -: 3128: -: 3129: /// Returns the size() of the largest possible %string. -: 3130: size_type -: 3131: max_size() const _GLIBCXX_NOEXCEPT -: 3132: { return _Rep::_S_max_size; } -: 3133: -: 3134: /** -: 3135: * @brief Resizes the %string to the specified number of characters. -: 3136: * @param __n Number of characters the %string should contain. -: 3137: * @param __c Character to fill any new elements. -: 3138: * -: 3139: * This function will %resize the %string to the specified -: 3140: * number of characters. If the number is smaller than the -: 3141: * %string's current size the %string is truncated, otherwise -: 3142: * the %string is extended and new elements are %set to @a __c. -: 3143: */ -: 3144: void -: 3145: resize(size_type __n, _CharT __c); -: 3146: -: 3147: /** -: 3148: * @brief Resizes the %string to the specified number of characters. -: 3149: * @param __n Number of characters the %string should contain. -: 3150: * -: 3151: * This function will resize the %string to the specified length. If -: 3152: * the new size is smaller than the %string's current size the %string -: 3153: * is truncated, otherwise the %string is extended and new characters -: 3154: * are default-constructed. For basic types such as char, this means -: 3155: * setting them to 0. -: 3156: */ -: 3157: void -: 3158: resize(size_type __n) -: 3159: { this->resize(__n, _CharT()); } -: 3160: -: 3161:#if __cplusplus >= 201103L -: 3162: /// A non-binding request to reduce capacity() to size(). -: 3163: void -: 3164: shrink_to_fit() _GLIBCXX_NOEXCEPT -: 3165: { -: 3166:#if __cpp_exceptions -: 3167: if (capacity() > size()) -: 3168: { -: 3169: try -: 3170: { reserve(0); } -: 3171: catch(...) -: 3172: { } -: 3173: } -: 3174:#endif -: 3175: } -: 3176:#endif -: 3177: -: 3178: /** -: 3179: * Returns the total number of characters that the %string can hold -: 3180: * before needing to allocate more memory. -: 3181: */ -: 3182: size_type -: 3183: capacity() const _GLIBCXX_NOEXCEPT -: 3184: { return _M_rep()->_M_capacity; } -: 3185: -: 3186: /** -: 3187: * @brief Attempt to preallocate enough memory for specified number of -: 3188: * characters. -: 3189: * @param __res_arg Number of characters required. -: 3190: * @throw std::length_error If @a __res_arg exceeds @c max_size(). -: 3191: * -: 3192: * This function attempts to reserve enough memory for the -: 3193: * %string to hold the specified number of characters. If the -: 3194: * number requested is more than max_size(), length_error is -: 3195: * thrown. -: 3196: * -: 3197: * The advantage of this function is that if optimal code is a -: 3198: * necessity and the user can determine the string length that will be -: 3199: * required, the user can reserve the memory in %advance, and thus -: 3200: * prevent a possible reallocation of memory and copying of %string -: 3201: * data. -: 3202: */ -: 3203: void -: 3204: reserve(size_type __res_arg = 0); -: 3205: -: 3206: /** -: 3207: * Erases the string, making it empty. -: 3208: */ -: 3209: // PR 56166: this should not throw. -: 3210: void -: 3211: clear() -: 3212: { _M_mutate(0, this->size(), 0); } -: 3213: -: 3214: /** -: 3215: * Returns true if the %string is empty. Equivalent to -: 3216: * *this == "". -: 3217: */ -: 3218: bool -: 3219: empty() const _GLIBCXX_NOEXCEPT -: 3220: { return this->size() == 0; } -: 3221: -: 3222: // Element access: -: 3223: /** -: 3224: * @brief Subscript access to the data contained in the %string. -: 3225: * @param __pos The index of the character to access. -: 3226: * @return Read-only (constant) reference to the character. -: 3227: * -: 3228: * This operator allows for easy, array-style, data access. -: 3229: * Note that data access with this operator is unchecked and -: 3230: * out_of_range lookups are not defined. (For checked lookups -: 3231: * see at().) -: 3232: */ -: 3233: const_reference -: 3234: operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT -: 3235: { -: 3236: _GLIBCXX_DEBUG_ASSERT(__pos <= size()); -: 3237: return _M_data()[__pos]; -: 3238: } -: 3239: -: 3240: /** -: 3241: * @brief Subscript access to the data contained in the %string. -: 3242: * @param __pos The index of the character to access. -: 3243: * @return Read/write reference to the character. -: 3244: * -: 3245: * This operator allows for easy, array-style, data access. -: 3246: * Note that data access with this operator is unchecked and -: 3247: * out_of_range lookups are not defined. (For checked lookups -: 3248: * see at().) Unshares the string. -: 3249: */ -: 3250: reference -: 3251: operator[](size_type __pos) -: 3252: { -: 3253: // Allow pos == size() both in C++98 mode, as v3 extension, -: 3254: // and in C++11 mode. -: 3255: _GLIBCXX_DEBUG_ASSERT(__pos <= size()); -: 3256: // In pedantic mode be strict in C++98 mode. -: 3257: _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos < size()); -: 3258: _M_leak(); -: 3259: return _M_data()[__pos]; -: 3260: } -: 3261: -: 3262: /** -: 3263: * @brief Provides access to the data contained in the %string. -: 3264: * @param __n The index of the character to access. -: 3265: * @return Read-only (const) reference to the character. -: 3266: * @throw std::out_of_range If @a n is an invalid index. -: 3267: * -: 3268: * This function provides for safer data access. The parameter is -: 3269: * first checked that it is in the range of the string. The function -: 3270: * throws out_of_range if the check fails. -: 3271: */ -: 3272: const_reference -: 3273: at(size_type __n) const -: 3274: { -: 3275: if (__n >= this->size()) -: 3276: __throw_out_of_range_fmt(__N("basic_string::at: __n " -: 3277: "(which is %zu) >= this->size() " -: 3278: "(which is %zu)"), -: 3279: __n, this->size()); -: 3280: return _M_data()[__n]; -: 3281: } -: 3282: -: 3283: /** -: 3284: * @brief Provides access to the data contained in the %string. -: 3285: * @param __n The index of the character to access. -: 3286: * @return Read/write reference to the character. -: 3287: * @throw std::out_of_range If @a n is an invalid index. -: 3288: * -: 3289: * This function provides for safer data access. The parameter is -: 3290: * first checked that it is in the range of the string. The function -: 3291: * throws out_of_range if the check fails. Success results in -: 3292: * unsharing the string. -: 3293: */ -: 3294: reference -: 3295: at(size_type __n) -: 3296: { -: 3297: if (__n >= size()) -: 3298: __throw_out_of_range_fmt(__N("basic_string::at: __n " -: 3299: "(which is %zu) >= this->size() " -: 3300: "(which is %zu)"), -: 3301: __n, this->size()); -: 3302: _M_leak(); -: 3303: return _M_data()[__n]; -: 3304: } -: 3305: -: 3306:#if __cplusplus >= 201103L -: 3307: /** -: 3308: * Returns a read/write reference to the data at the first -: 3309: * element of the %string. -: 3310: */ -: 3311: reference -: 3312: front() -: 3313: { return operator[](0); } -: 3314: -: 3315: /** -: 3316: * Returns a read-only (constant) reference to the data at the first -: 3317: * element of the %string. -: 3318: */ -: 3319: const_reference -: 3320: front() const _GLIBCXX_NOEXCEPT -: 3321: { return operator[](0); } -: 3322: -: 3323: /** -: 3324: * Returns a read/write reference to the data at the last -: 3325: * element of the %string. -: 3326: */ -: 3327: reference -: 3328: back() -: 3329: { return operator[](this->size() - 1); } -: 3330: -: 3331: /** -: 3332: * Returns a read-only (constant) reference to the data at the -: 3333: * last element of the %string. -: 3334: */ -: 3335: const_reference -: 3336: back() const _GLIBCXX_NOEXCEPT -: 3337: { return operator[](this->size() - 1); } -: 3338:#endif -: 3339: -: 3340: // Modifiers: -: 3341: /** -: 3342: * @brief Append a string to this string. -: 3343: * @param __str The string to append. -: 3344: * @return Reference to this string. -: 3345: */ -: 3346: basic_string& -: 3347: operator+=(const basic_string& __str) -: 3348: { return this->append(__str); } -: 3349: -: 3350: /** -: 3351: * @brief Append a C string. -: 3352: * @param __s The C string to append. -: 3353: * @return Reference to this string. -: 3354: */ -: 3355: basic_string& -: 3356: operator+=(const _CharT* __s) -: 3357: { return this->append(__s); } -: 3358: -: 3359: /** -: 3360: * @brief Append a character. -: 3361: * @param __c The character to append. -: 3362: * @return Reference to this string. -: 3363: */ -: 3364: basic_string& -: 3365: operator+=(_CharT __c) -: 3366: { -: 3367: this->push_back(__c); -: 3368: return *this; -: 3369: } -: 3370: -: 3371:#if __cplusplus >= 201103L -: 3372: /** -: 3373: * @brief Append an initializer_list of characters. -: 3374: * @param __l The initializer_list of characters to be appended. -: 3375: * @return Reference to this string. -: 3376: */ -: 3377: basic_string& -: 3378: operator+=(initializer_list<_CharT> __l) -: 3379: { return this->append(__l.begin(), __l.size()); } -: 3380:#endif // C++11 -: 3381: -: 3382: /** -: 3383: * @brief Append a string to this string. -: 3384: * @param __str The string to append. -: 3385: * @return Reference to this string. -: 3386: */ -: 3387: basic_string& -: 3388: append(const basic_string& __str); -: 3389: -: 3390: /** -: 3391: * @brief Append a substring. -: 3392: * @param __str The string to append. -: 3393: * @param __pos Index of the first character of str to append. -: 3394: * @param __n The number of characters to append. -: 3395: * @return Reference to this string. -: 3396: * @throw std::out_of_range if @a __pos is not a valid index. -: 3397: * -: 3398: * This function appends @a __n characters from @a __str -: 3399: * starting at @a __pos to this string. If @a __n is is larger -: 3400: * than the number of available characters in @a __str, the -: 3401: * remainder of @a __str is appended. -: 3402: */ -: 3403: basic_string& -: 3404: append(const basic_string& __str, size_type __pos, size_type __n); -: 3405: -: 3406: /** -: 3407: * @brief Append a C substring. -: 3408: * @param __s The C string to append. -: 3409: * @param __n The number of characters to append. -: 3410: * @return Reference to this string. -: 3411: */ -: 3412: basic_string& -: 3413: append(const _CharT* __s, size_type __n); -: 3414: -: 3415: /** -: 3416: * @brief Append a C string. -: 3417: * @param __s The C string to append. -: 3418: * @return Reference to this string. -: 3419: */ -: 3420: basic_string& -: 3421: append(const _CharT* __s) -: 3422: { -: 3423: __glibcxx_requires_string(__s); -: 3424: return this->append(__s, traits_type::length(__s)); -: 3425: } -: 3426: -: 3427: /** -: 3428: * @brief Append multiple characters. -: 3429: * @param __n The number of characters to append. -: 3430: * @param __c The character to use. -: 3431: * @return Reference to this string. -: 3432: * -: 3433: * Appends __n copies of __c to this string. -: 3434: */ -: 3435: basic_string& -: 3436: append(size_type __n, _CharT __c); -: 3437: -: 3438:#if __cplusplus >= 201103L -: 3439: /** -: 3440: * @brief Append an initializer_list of characters. -: 3441: * @param __l The initializer_list of characters to append. -: 3442: * @return Reference to this string. -: 3443: */ -: 3444: basic_string& -: 3445: append(initializer_list<_CharT> __l) -: 3446: { return this->append(__l.begin(), __l.size()); } -: 3447:#endif // C++11 -: 3448: -: 3449: /** -: 3450: * @brief Append a range of characters. -: 3451: * @param __first Iterator referencing the first character to append. -: 3452: * @param __last Iterator marking the end of the range. -: 3453: * @return Reference to this string. -: 3454: * -: 3455: * Appends characters in the range [__first,__last) to this string. -: 3456: */ -: 3457: template -: 3458: basic_string& -: 3459: append(_InputIterator __first, _InputIterator __last) -: 3460: { return this->replace(_M_iend(), _M_iend(), __first, __last); } -: 3461: -: 3462: /** -: 3463: * @brief Append a single character. -: 3464: * @param __c Character to append. -: 3465: */ -: 3466: void -: 3467: push_back(_CharT __c) -: 3468: { -: 3469: const size_type __len = 1 + this->size(); -: 3470: if (__len > this->capacity() || _M_rep()->_M_is_shared()) -: 3471: this->reserve(__len); -: 3472: traits_type::assign(_M_data()[this->size()], __c); -: 3473: _M_rep()->_M_set_length_and_sharable(__len); -: 3474: } -: 3475: -: 3476: /** -: 3477: * @brief Set value to contents of another string. -: 3478: * @param __str Source string to use. -: 3479: * @return Reference to this string. -: 3480: */ -: 3481: basic_string& -: 3482: assign(const basic_string& __str); -: 3483: -: 3484:#if __cplusplus >= 201103L -: 3485: /** -: 3486: * @brief Set value to contents of another string. -: 3487: * @param __str Source string to use. -: 3488: * @return Reference to this string. -: 3489: * -: 3490: * This function sets this string to the exact contents of @a __str. -: 3491: * @a __str is a valid, but unspecified string. -: 3492: */ -: 3493: // PR 58265, this should be noexcept. -: 3494: basic_string& -: 3495: assign(basic_string&& __str) -: 3496: { -: 3497: this->swap(__str); -: 3498: return *this; -: 3499: } -: 3500:#endif // C++11 -: 3501: -: 3502: /** -: 3503: * @brief Set value to a substring of a string. -: 3504: * @param __str The string to use. -: 3505: * @param __pos Index of the first character of str. -: 3506: * @param __n Number of characters to use. -: 3507: * @return Reference to this string. -: 3508: * @throw std::out_of_range if @a pos is not a valid index. -: 3509: * -: 3510: * This function sets this string to the substring of @a __str -: 3511: * consisting of @a __n characters at @a __pos. If @a __n is -: 3512: * is larger than the number of available characters in @a -: 3513: * __str, the remainder of @a __str is used. -: 3514: */ -: 3515: basic_string& -: 3516: assign(const basic_string& __str, size_type __pos, size_type __n) -: 3517: { return this->assign(__str._M_data() -: 3518: + __str._M_check(__pos, "basic_string::assign"), -: 3519: __str._M_limit(__pos, __n)); } -: 3520: -: 3521: /** -: 3522: * @brief Set value to a C substring. -: 3523: * @param __s The C string to use. -: 3524: * @param __n Number of characters to use. -: 3525: * @return Reference to this string. -: 3526: * -: 3527: * This function sets the value of this string to the first @a __n -: 3528: * characters of @a __s. If @a __n is is larger than the number of -: 3529: * available characters in @a __s, the remainder of @a __s is used. -: 3530: */ -: 3531: basic_string& -: 3532: assign(const _CharT* __s, size_type __n); -: 3533: -: 3534: /** -: 3535: * @brief Set value to contents of a C string. -: 3536: * @param __s The C string to use. -: 3537: * @return Reference to this string. -: 3538: * -: 3539: * This function sets the value of this string to the value of @a __s. -: 3540: * The data is copied, so there is no dependence on @a __s once the -: 3541: * function returns. -: 3542: */ -: 3543: basic_string& -: 3544: assign(const _CharT* __s) -: 3545: { -: 3546: __glibcxx_requires_string(__s); -: 3547: return this->assign(__s, traits_type::length(__s)); -: 3548: } -: 3549: -: 3550: /** -: 3551: * @brief Set value to multiple characters. -: 3552: * @param __n Length of the resulting string. -: 3553: * @param __c The character to use. -: 3554: * @return Reference to this string. -: 3555: * -: 3556: * This function sets the value of this string to @a __n copies of -: 3557: * character @a __c. -: 3558: */ -: 3559: basic_string& -: 3560: assign(size_type __n, _CharT __c) -: 3561: { return _M_replace_aux(size_type(0), this->size(), __n, __c); } -: 3562: -: 3563: /** -: 3564: * @brief Set value to a range of characters. -: 3565: * @param __first Iterator referencing the first character to append. -: 3566: * @param __last Iterator marking the end of the range. -: 3567: * @return Reference to this string. -: 3568: * -: 3569: * Sets value of string to characters in the range [__first,__last). -: 3570: */ -: 3571: template -: 3572: basic_string& -: 3573: assign(_InputIterator __first, _InputIterator __last) -: 3574: { return this->replace(_M_ibegin(), _M_iend(), __first, __last); } -: 3575: -: 3576:#if __cplusplus >= 201103L -: 3577: /** -: 3578: * @brief Set value to an initializer_list of characters. -: 3579: * @param __l The initializer_list of characters to assign. -: 3580: * @return Reference to this string. -: 3581: */ -: 3582: basic_string& -: 3583: assign(initializer_list<_CharT> __l) -: 3584: { return this->assign(__l.begin(), __l.size()); } -: 3585:#endif // C++11 -: 3586: -: 3587: /** -: 3588: * @brief Insert multiple characters. -: 3589: * @param __p Iterator referencing location in string to insert at. -: 3590: * @param __n Number of characters to insert -: 3591: * @param __c The character to insert. -: 3592: * @throw std::length_error If new length exceeds @c max_size(). -: 3593: * -: 3594: * Inserts @a __n copies of character @a __c starting at the -: 3595: * position referenced by iterator @a __p. If adding -: 3596: * characters causes the length to exceed max_size(), -: 3597: * length_error is thrown. The value of the string doesn't -: 3598: * change if an error is thrown. -: 3599: */ -: 3600: void -: 3601: insert(iterator __p, size_type __n, _CharT __c) -: 3602: { this->replace(__p, __p, __n, __c); } -: 3603: -: 3604: /** -: 3605: * @brief Insert a range of characters. -: 3606: * @param __p Iterator referencing location in string to insert at. -: 3607: * @param __beg Start of range. -: 3608: * @param __end End of range. -: 3609: * @throw std::length_error If new length exceeds @c max_size(). -: 3610: * -: 3611: * Inserts characters in range [__beg,__end). If adding -: 3612: * characters causes the length to exceed max_size(), -: 3613: * length_error is thrown. The value of the string doesn't -: 3614: * change if an error is thrown. -: 3615: */ -: 3616: template -: 3617: void -: 3618: insert(iterator __p, _InputIterator __beg, _InputIterator __end) -: 3619: { this->replace(__p, __p, __beg, __end); } -: 3620: -: 3621:#if __cplusplus >= 201103L -: 3622: /** -: 3623: * @brief Insert an initializer_list of characters. -: 3624: * @param __p Iterator referencing location in string to insert at. -: 3625: * @param __l The initializer_list of characters to insert. -: 3626: * @throw std::length_error If new length exceeds @c max_size(). -: 3627: */ -: 3628: void -: 3629: insert(iterator __p, initializer_list<_CharT> __l) -: 3630: { -: 3631: _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend()); -: 3632: this->insert(__p - _M_ibegin(), __l.begin(), __l.size()); -: 3633: } -: 3634:#endif // C++11 -: 3635: -: 3636: /** -: 3637: * @brief Insert value of a string. -: 3638: * @param __pos1 Iterator referencing location in string to insert at. -: 3639: * @param __str The string to insert. -: 3640: * @return Reference to this string. -: 3641: * @throw std::length_error If new length exceeds @c max_size(). -: 3642: * -: 3643: * Inserts value of @a __str starting at @a __pos1. If adding -: 3644: * characters causes the length to exceed max_size(), -: 3645: * length_error is thrown. The value of the string doesn't -: 3646: * change if an error is thrown. -: 3647: */ -: 3648: basic_string& -: 3649: insert(size_type __pos1, const basic_string& __str) -: 3650: { return this->insert(__pos1, __str, size_type(0), __str.size()); } -: 3651: -: 3652: /** -: 3653: * @brief Insert a substring. -: 3654: * @param __pos1 Iterator referencing location in string to insert at. -: 3655: * @param __str The string to insert. -: 3656: * @param __pos2 Start of characters in str to insert. -: 3657: * @param __n Number of characters to insert. -: 3658: * @return Reference to this string. -: 3659: * @throw std::length_error If new length exceeds @c max_size(). -: 3660: * @throw std::out_of_range If @a pos1 > size() or -: 3661: * @a __pos2 > @a str.size(). -: 3662: * -: 3663: * Starting at @a pos1, insert @a __n character of @a __str -: 3664: * beginning with @a __pos2. If adding characters causes the -: 3665: * length to exceed max_size(), length_error is thrown. If @a -: 3666: * __pos1 is beyond the end of this string or @a __pos2 is -: 3667: * beyond the end of @a __str, out_of_range is thrown. The -: 3668: * value of the string doesn't change if an error is thrown. -: 3669: */ -: 3670: basic_string& -: 3671: insert(size_type __pos1, const basic_string& __str, -: 3672: size_type __pos2, size_type __n) -: 3673: { return this->insert(__pos1, __str._M_data() -: 3674: + __str._M_check(__pos2, "basic_string::insert"), -: 3675: __str._M_limit(__pos2, __n)); } -: 3676: -: 3677: /** -: 3678: * @brief Insert a C substring. -: 3679: * @param __pos Iterator referencing location in string to insert at. -: 3680: * @param __s The C string to insert. -: 3681: * @param __n The number of characters to insert. -: 3682: * @return Reference to this string. -: 3683: * @throw std::length_error If new length exceeds @c max_size(). -: 3684: * @throw std::out_of_range If @a __pos is beyond the end of this -: 3685: * string. -: 3686: * -: 3687: * Inserts the first @a __n characters of @a __s starting at @a -: 3688: * __pos. If adding characters causes the length to exceed -: 3689: * max_size(), length_error is thrown. If @a __pos is beyond -: 3690: * end(), out_of_range is thrown. The value of the string -: 3691: * doesn't change if an error is thrown. -: 3692: */ -: 3693: basic_string& -: 3694: insert(size_type __pos, const _CharT* __s, size_type __n); -: 3695: -: 3696: /** -: 3697: * @brief Insert a C string. -: 3698: * @param __pos Iterator referencing location in string to insert at. -: 3699: * @param __s The C string to insert. -: 3700: * @return Reference to this string. -: 3701: * @throw std::length_error If new length exceeds @c max_size(). -: 3702: * @throw std::out_of_range If @a pos is beyond the end of this -: 3703: * string. -: 3704: * -: 3705: * Inserts the first @a n characters of @a __s starting at @a __pos. If -: 3706: * adding characters causes the length to exceed max_size(), -: 3707: * length_error is thrown. If @a __pos is beyond end(), out_of_range is -: 3708: * thrown. The value of the string doesn't change if an error is -: 3709: * thrown. -: 3710: */ -: 3711: basic_string& -: 3712: insert(size_type __pos, const _CharT* __s) -: 3713: { -: 3714: __glibcxx_requires_string(__s); -: 3715: return this->insert(__pos, __s, traits_type::length(__s)); -: 3716: } -: 3717: -: 3718: /** -: 3719: * @brief Insert multiple characters. -: 3720: * @param __pos Index in string to insert at. -: 3721: * @param __n Number of characters to insert -: 3722: * @param __c The character to insert. -: 3723: * @return Reference to this string. -: 3724: * @throw std::length_error If new length exceeds @c max_size(). -: 3725: * @throw std::out_of_range If @a __pos is beyond the end of this -: 3726: * string. -: 3727: * -: 3728: * Inserts @a __n copies of character @a __c starting at index -: 3729: * @a __pos. If adding characters causes the length to exceed -: 3730: * max_size(), length_error is thrown. If @a __pos > length(), -: 3731: * out_of_range is thrown. The value of the string doesn't -: 3732: * change if an error is thrown. -: 3733: */ -: 3734: basic_string& -: 3735: insert(size_type __pos, size_type __n, _CharT __c) -: 3736: { return _M_replace_aux(_M_check(__pos, "basic_string::insert"), -: 3737: size_type(0), __n, __c); } -: 3738: -: 3739: /** -: 3740: * @brief Insert one character. -: 3741: * @param __p Iterator referencing position in string to insert at. -: 3742: * @param __c The character to insert. -: 3743: * @return Iterator referencing newly inserted char. -: 3744: * @throw std::length_error If new length exceeds @c max_size(). -: 3745: * -: 3746: * Inserts character @a __c at position referenced by @a __p. -: 3747: * If adding character causes the length to exceed max_size(), -: 3748: * length_error is thrown. If @a __p is beyond end of string, -: 3749: * out_of_range is thrown. The value of the string doesn't -: 3750: * change if an error is thrown. -: 3751: */ -: 3752: iterator -: 3753: insert(iterator __p, _CharT __c) -: 3754: { -: 3755: _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend()); -: 3756: const size_type __pos = __p - _M_ibegin(); -: 3757: _M_replace_aux(__pos, size_type(0), size_type(1), __c); -: 3758: _M_rep()->_M_set_leaked(); -: 3759: return iterator(_M_data() + __pos); -: 3760: } -: 3761: -: 3762: /** -: 3763: * @brief Remove characters. -: 3764: * @param __pos Index of first character to remove (default 0). -: 3765: * @param __n Number of characters to remove (default remainder). -: 3766: * @return Reference to this string. -: 3767: * @throw std::out_of_range If @a pos is beyond the end of this -: 3768: * string. -: 3769: * -: 3770: * Removes @a __n characters from this string starting at @a -: 3771: * __pos. The length of the string is reduced by @a __n. If -: 3772: * there are < @a __n characters to remove, the remainder of -: 3773: * the string is truncated. If @a __p is beyond end of string, -: 3774: * out_of_range is thrown. The value of the string doesn't -: 3775: * change if an error is thrown. -: 3776: */ -: 3777: basic_string& -: 3778: erase(size_type __pos = 0, size_type __n = npos) -: 3779: { -: 3780: _M_mutate(_M_check(__pos, "basic_string::erase"), -: 3781: _M_limit(__pos, __n), size_type(0)); -: 3782: return *this; -: 3783: } -: 3784: -: 3785: /** -: 3786: * @brief Remove one character. -: 3787: * @param __position Iterator referencing the character to remove. -: 3788: * @return iterator referencing same location after removal. -: 3789: * -: 3790: * Removes the character at @a __position from this string. The value -: 3791: * of the string doesn't change if an error is thrown. -: 3792: */ -: 3793: iterator -: 3794: erase(iterator __position) -: 3795: { -: 3796: _GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin() -: 3797: && __position < _M_iend()); -: 3798: const size_type __pos = __position - _M_ibegin(); -: 3799: _M_mutate(__pos, size_type(1), size_type(0)); -: 3800: _M_rep()->_M_set_leaked(); -: 3801: return iterator(_M_data() + __pos); -: 3802: } -: 3803: -: 3804: /** -: 3805: * @brief Remove a range of characters. -: 3806: * @param __first Iterator referencing the first character to remove. -: 3807: * @param __last Iterator referencing the end of the range. -: 3808: * @return Iterator referencing location of first after removal. -: 3809: * -: 3810: * Removes the characters in the range [first,last) from this string. -: 3811: * The value of the string doesn't change if an error is thrown. -: 3812: */ -: 3813: iterator -: 3814: erase(iterator __first, iterator __last); -: 3815: -: 3816:#if __cplusplus >= 201103L -: 3817: /** -: 3818: * @brief Remove the last character. -: 3819: * -: 3820: * The string must be non-empty. -: 3821: */ -: 3822: void -: 3823: pop_back() // FIXME C++11: should be noexcept. -: 3824: { erase(size()-1, 1); } -: 3825:#endif // C++11 -: 3826: -: 3827: /** -: 3828: * @brief Replace characters with value from another string. -: 3829: * @param __pos Index of first character to replace. -: 3830: * @param __n Number of characters to be replaced. -: 3831: * @param __str String to insert. -: 3832: * @return Reference to this string. -: 3833: * @throw std::out_of_range If @a pos is beyond the end of this -: 3834: * string. -: 3835: * @throw std::length_error If new length exceeds @c max_size(). -: 3836: * -: 3837: * Removes the characters in the range [__pos,__pos+__n) from -: 3838: * this string. In place, the value of @a __str is inserted. -: 3839: * If @a __pos is beyond end of string, out_of_range is thrown. -: 3840: * If the length of the result exceeds max_size(), length_error -: 3841: * is thrown. The value of the string doesn't change if an -: 3842: * error is thrown. -: 3843: */ -: 3844: basic_string& -: 3845: replace(size_type __pos, size_type __n, const basic_string& __str) -: 3846: { return this->replace(__pos, __n, __str._M_data(), __str.size()); } -: 3847: -: 3848: /** -: 3849: * @brief Replace characters with value from another string. -: 3850: * @param __pos1 Index of first character to replace. -: 3851: * @param __n1 Number of characters to be replaced. -: 3852: * @param __str String to insert. -: 3853: * @param __pos2 Index of first character of str to use. -: 3854: * @param __n2 Number of characters from str to use. -: 3855: * @return Reference to this string. -: 3856: * @throw std::out_of_range If @a __pos1 > size() or @a __pos2 > -: 3857: * __str.size(). -: 3858: * @throw std::length_error If new length exceeds @c max_size(). -: 3859: * -: 3860: * Removes the characters in the range [__pos1,__pos1 + n) from this -: 3861: * string. In place, the value of @a __str is inserted. If @a __pos is -: 3862: * beyond end of string, out_of_range is thrown. If the length of the -: 3863: * result exceeds max_size(), length_error is thrown. The value of the -: 3864: * string doesn't change if an error is thrown. -: 3865: */ -: 3866: basic_string& -: 3867: replace(size_type __pos1, size_type __n1, const basic_string& __str, -: 3868: size_type __pos2, size_type __n2) -: 3869: { return this->replace(__pos1, __n1, __str._M_data() -: 3870: + __str._M_check(__pos2, "basic_string::replace"), -: 3871: __str._M_limit(__pos2, __n2)); } -: 3872: -: 3873: /** -: 3874: * @brief Replace characters with value of a C substring. -: 3875: * @param __pos Index of first character to replace. -: 3876: * @param __n1 Number of characters to be replaced. -: 3877: * @param __s C string to insert. -: 3878: * @param __n2 Number of characters from @a s to use. -: 3879: * @return Reference to this string. -: 3880: * @throw std::out_of_range If @a pos1 > size(). -: 3881: * @throw std::length_error If new length exceeds @c max_size(). -: 3882: * -: 3883: * Removes the characters in the range [__pos,__pos + __n1) -: 3884: * from this string. In place, the first @a __n2 characters of -: 3885: * @a __s are inserted, or all of @a __s if @a __n2 is too large. If -: 3886: * @a __pos is beyond end of string, out_of_range is thrown. If -: 3887: * the length of result exceeds max_size(), length_error is -: 3888: * thrown. The value of the string doesn't change if an error -: 3889: * is thrown. -: 3890: */ -: 3891: basic_string& -: 3892: replace(size_type __pos, size_type __n1, const _CharT* __s, -: 3893: size_type __n2); -: 3894: -: 3895: /** -: 3896: * @brief Replace characters with value of a C string. -: 3897: * @param __pos Index of first character to replace. -: 3898: * @param __n1 Number of characters to be replaced. -: 3899: * @param __s C string to insert. -: 3900: * @return Reference to this string. -: 3901: * @throw std::out_of_range If @a pos > size(). -: 3902: * @throw std::length_error If new length exceeds @c max_size(). -: 3903: * -: 3904: * Removes the characters in the range [__pos,__pos + __n1) -: 3905: * from this string. In place, the characters of @a __s are -: 3906: * inserted. If @a __pos is beyond end of string, out_of_range -: 3907: * is thrown. If the length of result exceeds max_size(), -: 3908: * length_error is thrown. The value of the string doesn't -: 3909: * change if an error is thrown. -: 3910: */ -: 3911: basic_string& -: 3912: replace(size_type __pos, size_type __n1, const _CharT* __s) -: 3913: { -: 3914: __glibcxx_requires_string(__s); -: 3915: return this->replace(__pos, __n1, __s, traits_type::length(__s)); -: 3916: } -: 3917: -: 3918: /** -: 3919: * @brief Replace characters with multiple characters. -: 3920: * @param __pos Index of first character to replace. -: 3921: * @param __n1 Number of characters to be replaced. -: 3922: * @param __n2 Number of characters to insert. -: 3923: * @param __c Character to insert. -: 3924: * @return Reference to this string. -: 3925: * @throw std::out_of_range If @a __pos > size(). -: 3926: * @throw std::length_error If new length exceeds @c max_size(). -: 3927: * -: 3928: * Removes the characters in the range [pos,pos + n1) from this -: 3929: * string. In place, @a __n2 copies of @a __c are inserted. -: 3930: * If @a __pos is beyond end of string, out_of_range is thrown. -: 3931: * If the length of result exceeds max_size(), length_error is -: 3932: * thrown. The value of the string doesn't change if an error -: 3933: * is thrown. -: 3934: */ -: 3935: basic_string& -: 3936: replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) -: 3937: { return _M_replace_aux(_M_check(__pos, "basic_string::replace"), -: 3938: _M_limit(__pos, __n1), __n2, __c); } -: 3939: -: 3940: /** -: 3941: * @brief Replace range of characters with string. -: 3942: * @param __i1 Iterator referencing start of range to replace. -: 3943: * @param __i2 Iterator referencing end of range to replace. -: 3944: * @param __str String value to insert. -: 3945: * @return Reference to this string. -: 3946: * @throw std::length_error If new length exceeds @c max_size(). -: 3947: * -: 3948: * Removes the characters in the range [__i1,__i2). In place, -: 3949: * the value of @a __str is inserted. If the length of result -: 3950: * exceeds max_size(), length_error is thrown. The value of -: 3951: * the string doesn't change if an error is thrown. -: 3952: */ -: 3953: basic_string& -: 3954: replace(iterator __i1, iterator __i2, const basic_string& __str) -: 3955: { return this->replace(__i1, __i2, __str._M_data(), __str.size()); } -: 3956: -: 3957: /** -: 3958: * @brief Replace range of characters with C substring. -: 3959: * @param __i1 Iterator referencing start of range to replace. -: 3960: * @param __i2 Iterator referencing end of range to replace. -: 3961: * @param __s C string value to insert. -: 3962: * @param __n Number of characters from s to insert. -: 3963: * @return Reference to this string. -: 3964: * @throw std::length_error If new length exceeds @c max_size(). -: 3965: * -: 3966: * Removes the characters in the range [__i1,__i2). In place, -: 3967: * the first @a __n characters of @a __s are inserted. If the -: 3968: * length of result exceeds max_size(), length_error is thrown. -: 3969: * The value of the string doesn't change if an error is -: 3970: * thrown. -: 3971: */ -: 3972: basic_string& -: 3973: replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n) -: 3974: { -: 3975: _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 -: 3976: && __i2 <= _M_iend()); -: 3977: return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n); -: 3978: } -: 3979: -: 3980: /** -: 3981: * @brief Replace range of characters with C string. -: 3982: * @param __i1 Iterator referencing start of range to replace. -: 3983: * @param __i2 Iterator referencing end of range to replace. -: 3984: * @param __s C string value to insert. -: 3985: * @return Reference to this string. -: 3986: * @throw std::length_error If new length exceeds @c max_size(). -: 3987: * -: 3988: * Removes the characters in the range [__i1,__i2). In place, -: 3989: * the characters of @a __s are inserted. If the length of -: 3990: * result exceeds max_size(), length_error is thrown. The -: 3991: * value of the string doesn't change if an error is thrown. -: 3992: */ -: 3993: basic_string& -: 3994: replace(iterator __i1, iterator __i2, const _CharT* __s) -: 3995: { -: 3996: __glibcxx_requires_string(__s); -: 3997: return this->replace(__i1, __i2, __s, traits_type::length(__s)); -: 3998: } -: 3999: -: 4000: /** -: 4001: * @brief Replace range of characters with multiple characters -: 4002: * @param __i1 Iterator referencing start of range to replace. -: 4003: * @param __i2 Iterator referencing end of range to replace. -: 4004: * @param __n Number of characters to insert. -: 4005: * @param __c Character to insert. -: 4006: * @return Reference to this string. -: 4007: * @throw std::length_error If new length exceeds @c max_size(). -: 4008: * -: 4009: * Removes the characters in the range [__i1,__i2). In place, -: 4010: * @a __n copies of @a __c are inserted. If the length of -: 4011: * result exceeds max_size(), length_error is thrown. The -: 4012: * value of the string doesn't change if an error is thrown. -: 4013: */ -: 4014: basic_string& -: 4015: replace(iterator __i1, iterator __i2, size_type __n, _CharT __c) -: 4016: { -: 4017: _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 -: 4018: && __i2 <= _M_iend()); -: 4019: return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c); -: 4020: } -: 4021: -: 4022: /** -: 4023: * @brief Replace range of characters with range. -: 4024: * @param __i1 Iterator referencing start of range to replace. -: 4025: * @param __i2 Iterator referencing end of range to replace. -: 4026: * @param __k1 Iterator referencing start of range to insert. -: 4027: * @param __k2 Iterator referencing end of range to insert. -: 4028: * @return Reference to this string. -: 4029: * @throw std::length_error If new length exceeds @c max_size(). -: 4030: * -: 4031: * Removes the characters in the range [__i1,__i2). In place, -: 4032: * characters in the range [__k1,__k2) are inserted. If the -: 4033: * length of result exceeds max_size(), length_error is thrown. -: 4034: * The value of the string doesn't change if an error is -: 4035: * thrown. -: 4036: */ -: 4037: template -: 4038: basic_string& -: 4039: replace(iterator __i1, iterator __i2, -: 4040: _InputIterator __k1, _InputIterator __k2) -: 4041: { -: 4042: _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 -: 4043: && __i2 <= _M_iend()); -: 4044: __glibcxx_requires_valid_range(__k1, __k2); -: 4045: typedef typename std::__is_integer<_InputIterator>::__type _Integral; -: 4046: return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral()); -: 4047: } -: 4048: -: 4049: // Specializations for the common case of pointer and iterator: -: 4050: // useful to avoid the overhead of temporary buffering in _M_replace. -: 4051: basic_string& -: 4052: replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2) -: 4053: { -: 4054: _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 -: 4055: && __i2 <= _M_iend()); -: 4056: __glibcxx_requires_valid_range(__k1, __k2); -: 4057: return this->replace(__i1 - _M_ibegin(), __i2 - __i1, -: 4058: __k1, __k2 - __k1); -: 4059: } -: 4060: -: 4061: basic_string& -: 4062: replace(iterator __i1, iterator __i2, -: 4063: const _CharT* __k1, const _CharT* __k2) -: 4064: { -: 4065: _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 -: 4066: && __i2 <= _M_iend()); -: 4067: __glibcxx_requires_valid_range(__k1, __k2); -: 4068: return this->replace(__i1 - _M_ibegin(), __i2 - __i1, -: 4069: __k1, __k2 - __k1); -: 4070: } -: 4071: -: 4072: basic_string& -: 4073: replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2) -: 4074: { -: 4075: _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 -: 4076: && __i2 <= _M_iend()); -: 4077: __glibcxx_requires_valid_range(__k1, __k2); -: 4078: return this->replace(__i1 - _M_ibegin(), __i2 - __i1, -: 4079: __k1.base(), __k2 - __k1); -: 4080: } -: 4081: -: 4082: basic_string& -: 4083: replace(iterator __i1, iterator __i2, -: 4084: const_iterator __k1, const_iterator __k2) -: 4085: { -: 4086: _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 -: 4087: && __i2 <= _M_iend()); -: 4088: __glibcxx_requires_valid_range(__k1, __k2); -: 4089: return this->replace(__i1 - _M_ibegin(), __i2 - __i1, -: 4090: __k1.base(), __k2 - __k1); -: 4091: } -: 4092: -: 4093:#if __cplusplus >= 201103L -: 4094: /** -: 4095: * @brief Replace range of characters with initializer_list. -: 4096: * @param __i1 Iterator referencing start of range to replace. -: 4097: * @param __i2 Iterator referencing end of range to replace. -: 4098: * @param __l The initializer_list of characters to insert. -: 4099: * @return Reference to this string. -: 4100: * @throw std::length_error If new length exceeds @c max_size(). -: 4101: * -: 4102: * Removes the characters in the range [__i1,__i2). In place, -: 4103: * characters in the range [__k1,__k2) are inserted. If the -: 4104: * length of result exceeds max_size(), length_error is thrown. -: 4105: * The value of the string doesn't change if an error is -: 4106: * thrown. -: 4107: */ -: 4108: basic_string& replace(iterator __i1, iterator __i2, -: 4109: initializer_list<_CharT> __l) -: 4110: { return this->replace(__i1, __i2, __l.begin(), __l.end()); } -: 4111:#endif // C++11 -: 4112: -: 4113: private: -: 4114: template -: 4115: basic_string& -: 4116: _M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n, -: 4117: _Integer __val, __true_type) -: 4118: { return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); } -: 4119: -: 4120: template -: 4121: basic_string& -: 4122: _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1, -: 4123: _InputIterator __k2, __false_type); -: 4124: -: 4125: basic_string& -: 4126: _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, -: 4127: _CharT __c); -: 4128: -: 4129: basic_string& -: 4130: _M_replace_safe(size_type __pos1, size_type __n1, const _CharT* __s, -: 4131: size_type __n2); -: 4132: -: 4133: // _S_construct_aux is used to implement the 21.3.1 para 15 which -: 4134: // requires special behaviour if _InIter is an integral type -: 4135: template -: 4136: static _CharT* -: 4137: _S_construct_aux(_InIterator __beg, _InIterator __end, -: 4138: const _Alloc& __a, __false_type) -: 4139: { -: 4140: typedef typename iterator_traits<_InIterator>::iterator_category _Tag; -: 4141: return _S_construct(__beg, __end, __a, _Tag()); -: 4142: } -: 4143: -: 4144: // _GLIBCXX_RESOLVE_LIB_DEFECTS -: 4145: // 438. Ambiguity in the "do the right thing" clause -: 4146: template -: 4147: static _CharT* -: 4148: _S_construct_aux(_Integer __beg, _Integer __end, -: 4149: const _Alloc& __a, __true_type) -: 4150: { return _S_construct_aux_2(static_cast(__beg), -: 4151: __end, __a); } -: 4152: -: 4153: static _CharT* -: 4154: _S_construct_aux_2(size_type __req, _CharT __c, const _Alloc& __a) -: 4155: { return _S_construct(__req, __c, __a); } -: 4156: -: 4157: template -: 4158: static _CharT* -: 4159: _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a) -: 4160: { -: 4161: typedef typename std::__is_integer<_InIterator>::__type _Integral; -: 4162: return _S_construct_aux(__beg, __end, __a, _Integral()); -: 4163: } -: 4164: -: 4165: // For Input Iterators, used in istreambuf_iterators, etc. -: 4166: template -: 4167: static _CharT* -: 4168: _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a, -: 4169: input_iterator_tag); -: 4170: -: 4171: // For forward_iterators up to random_access_iterators, used for -: 4172: // string::iterator, _CharT*, etc. -: 4173: template -: 4174: static _CharT* -: 4175: _S_construct(_FwdIterator __beg, _FwdIterator __end, const _Alloc& __a, -: 4176: forward_iterator_tag); -: 4177: -: 4178: static _CharT* -: 4179: _S_construct(size_type __req, _CharT __c, const _Alloc& __a); -: 4180: -: 4181: public: -: 4182: -: 4183: /** -: 4184: * @brief Copy substring into C string. -: 4185: * @param __s C string to copy value into. -: 4186: * @param __n Number of characters to copy. -: 4187: * @param __pos Index of first character to copy. -: 4188: * @return Number of characters actually copied -: 4189: * @throw std::out_of_range If __pos > size(). -: 4190: * -: 4191: * Copies up to @a __n characters starting at @a __pos into the -: 4192: * C string @a __s. If @a __pos is %greater than size(), -: 4193: * out_of_range is thrown. -: 4194: */ -: 4195: size_type -: 4196: copy(_CharT* __s, size_type __n, size_type __pos = 0) const; -: 4197: -: 4198: /** -: 4199: * @brief Swap contents with another string. -: 4200: * @param __s String to swap with. -: 4201: * -: 4202: * Exchanges the contents of this string with that of @a __s in constant -: 4203: * time. -: 4204: */ -: 4205: // PR 58265, this should be noexcept. -: 4206: void -: 4207: swap(basic_string& __s); -: 4208: -: 4209: // String operations: -: 4210: /** -: 4211: * @brief Return const pointer to null-terminated contents. -: 4212: * -: 4213: * This is a handle to internal data. Do not modify or dire things may -: 4214: * happen. -: 4215: */ -: 4216: const _CharT* -: 4217: c_str() const _GLIBCXX_NOEXCEPT -: 4218: { return _M_data(); } -: 4219: -: 4220: /** -: 4221: * @brief Return const pointer to contents. -: 4222: * -: 4223: * This is a handle to internal data. Do not modify or dire things may -: 4224: * happen. -: 4225: */ -: 4226: const _CharT* -: 4227: data() const _GLIBCXX_NOEXCEPT -: 4228: { return _M_data(); } -: 4229: -: 4230: /** -: 4231: * @brief Return copy of allocator used to construct this string. -: 4232: */ -: 4233: allocator_type -: 4234: get_allocator() const _GLIBCXX_NOEXCEPT -: 4235: { return _M_dataplus; } -: 4236: -: 4237: /** -: 4238: * @brief Find position of a C substring. -: 4239: * @param __s C string to locate. -: 4240: * @param __pos Index of character to search from. -: 4241: * @param __n Number of characters from @a s to search for. -: 4242: * @return Index of start of first occurrence. -: 4243: * -: 4244: * Starting from @a __pos, searches forward for the first @a -: 4245: * __n characters in @a __s within this string. If found, -: 4246: * returns the index where it begins. If not found, returns -: 4247: * npos. -: 4248: */ -: 4249: size_type -: 4250: find(const _CharT* __s, size_type __pos, size_type __n) const; -: 4251: -: 4252: /** -: 4253: * @brief Find position of a string. -: 4254: * @param __str String to locate. -: 4255: * @param __pos Index of character to search from (default 0). -: 4256: * @return Index of start of first occurrence. -: 4257: * -: 4258: * Starting from @a __pos, searches forward for value of @a __str within -: 4259: * this string. If found, returns the index where it begins. If not -: 4260: * found, returns npos. -: 4261: */ -: 4262: size_type -: 4263: find(const basic_string& __str, size_type __pos = 0) const -: 4264: _GLIBCXX_NOEXCEPT -: 4265: { return this->find(__str.data(), __pos, __str.size()); } -: 4266: -: 4267: /** -: 4268: * @brief Find position of a C string. -: 4269: * @param __s C string to locate. -: 4270: * @param __pos Index of character to search from (default 0). -: 4271: * @return Index of start of first occurrence. -: 4272: * -: 4273: * Starting from @a __pos, searches forward for the value of @a -: 4274: * __s within this string. If found, returns the index where -: 4275: * it begins. If not found, returns npos. -: 4276: */ -: 4277: size_type -: 4278: find(const _CharT* __s, size_type __pos = 0) const -: 4279: { -: 4280: __glibcxx_requires_string(__s); -: 4281: return this->find(__s, __pos, traits_type::length(__s)); -: 4282: } -: 4283: -: 4284: /** -: 4285: * @brief Find position of a character. -: 4286: * @param __c Character to locate. -: 4287: * @param __pos Index of character to search from (default 0). -: 4288: * @return Index of first occurrence. -: 4289: * -: 4290: * Starting from @a __pos, searches forward for @a __c within -: 4291: * this string. If found, returns the index where it was -: 4292: * found. If not found, returns npos. -: 4293: */ -: 4294: size_type -: 4295: find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT; -: 4296: -: 4297: /** -: 4298: * @brief Find last position of a string. -: 4299: * @param __str String to locate. -: 4300: * @param __pos Index of character to search back from (default end). -: 4301: * @return Index of start of last occurrence. -: 4302: * -: 4303: * Starting from @a __pos, searches backward for value of @a -: 4304: * __str within this string. If found, returns the index where -: 4305: * it begins. If not found, returns npos. -: 4306: */ -: 4307: size_type -: 4308: rfind(const basic_string& __str, size_type __pos = npos) const -: 4309: _GLIBCXX_NOEXCEPT -: 4310: { return this->rfind(__str.data(), __pos, __str.size()); } -: 4311: -: 4312: /** -: 4313: * @brief Find last position of a C substring. -: 4314: * @param __s C string to locate. -: 4315: * @param __pos Index of character to search back from. -: 4316: * @param __n Number of characters from s to search for. -: 4317: * @return Index of start of last occurrence. -: 4318: * -: 4319: * Starting from @a __pos, searches backward for the first @a -: 4320: * __n characters in @a __s within this string. If found, -: 4321: * returns the index where it begins. If not found, returns -: 4322: * npos. -: 4323: */ -: 4324: size_type -: 4325: rfind(const _CharT* __s, size_type __pos, size_type __n) const; -: 4326: -: 4327: /** -: 4328: * @brief Find last position of a C string. -: 4329: * @param __s C string to locate. -: 4330: * @param __pos Index of character to start search at (default end). -: 4331: * @return Index of start of last occurrence. -: 4332: * -: 4333: * Starting from @a __pos, searches backward for the value of -: 4334: * @a __s within this string. If found, returns the index -: 4335: * where it begins. If not found, returns npos. -: 4336: */ -: 4337: size_type -: 4338: rfind(const _CharT* __s, size_type __pos = npos) const -: 4339: { -: 4340: __glibcxx_requires_string(__s); -: 4341: return this->rfind(__s, __pos, traits_type::length(__s)); -: 4342: } -: 4343: -: 4344: /** -: 4345: * @brief Find last position of a character. -: 4346: * @param __c Character to locate. -: 4347: * @param __pos Index of character to search back from (default end). -: 4348: * @return Index of last occurrence. -: 4349: * -: 4350: * Starting from @a __pos, searches backward for @a __c within -: 4351: * this string. If found, returns the index where it was -: 4352: * found. If not found, returns npos. -: 4353: */ -: 4354: size_type -: 4355: rfind(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT; -: 4356: -: 4357: /** -: 4358: * @brief Find position of a character of string. -: 4359: * @param __str String containing characters to locate. -: 4360: * @param __pos Index of character to search from (default 0). -: 4361: * @return Index of first occurrence. -: 4362: * -: 4363: * Starting from @a __pos, searches forward for one of the -: 4364: * characters of @a __str within this string. If found, -: 4365: * returns the index where it was found. If not found, returns -: 4366: * npos. -: 4367: */ -: 4368: size_type -: 4369: find_first_of(const basic_string& __str, size_type __pos = 0) const -: 4370: _GLIBCXX_NOEXCEPT -: 4371: { return this->find_first_of(__str.data(), __pos, __str.size()); } -: 4372: -: 4373: /** -: 4374: * @brief Find position of a character of C substring. -: 4375: * @param __s String containing characters to locate. -: 4376: * @param __pos Index of character to search from. -: 4377: * @param __n Number of characters from s to search for. -: 4378: * @return Index of first occurrence. -: 4379: * -: 4380: * Starting from @a __pos, searches forward for one of the -: 4381: * first @a __n characters of @a __s within this string. If -: 4382: * found, returns the index where it was found. If not found, -: 4383: * returns npos. -: 4384: */ -: 4385: size_type -: 4386: find_first_of(const _CharT* __s, size_type __pos, size_type __n) const; -: 4387: -: 4388: /** -: 4389: * @brief Find position of a character of C string. -: 4390: * @param __s String containing characters to locate. -: 4391: * @param __pos Index of character to search from (default 0). -: 4392: * @return Index of first occurrence. -: 4393: * -: 4394: * Starting from @a __pos, searches forward for one of the -: 4395: * characters of @a __s within this string. If found, returns -: 4396: * the index where it was found. If not found, returns npos. -: 4397: */ -: 4398: size_type -: 4399: find_first_of(const _CharT* __s, size_type __pos = 0) const -: 4400: { -: 4401: __glibcxx_requires_string(__s); -: 4402: return this->find_first_of(__s, __pos, traits_type::length(__s)); -: 4403: } -: 4404: -: 4405: /** -: 4406: * @brief Find position of a character. -: 4407: * @param __c Character to locate. -: 4408: * @param __pos Index of character to search from (default 0). -: 4409: * @return Index of first occurrence. -: 4410: * -: 4411: * Starting from @a __pos, searches forward for the character -: 4412: * @a __c within this string. If found, returns the index -: 4413: * where it was found. If not found, returns npos. -: 4414: * -: 4415: * Note: equivalent to find(__c, __pos). -: 4416: */ -: 4417: size_type -: 4418: find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT -: 4419: { return this->find(__c, __pos); } -: 4420: -: 4421: /** -: 4422: * @brief Find last position of a character of string. -: 4423: * @param __str String containing characters to locate. -: 4424: * @param __pos Index of character to search back from (default end). -: 4425: * @return Index of last occurrence. -: 4426: * -: 4427: * Starting from @a __pos, searches backward for one of the -: 4428: * characters of @a __str within this string. If found, -: 4429: * returns the index where it was found. If not found, returns -: 4430: * npos. -: 4431: */ -: 4432: size_type -: 4433: find_last_of(const basic_string& __str, size_type __pos = npos) const -: 4434: _GLIBCXX_NOEXCEPT -: 4435: { return this->find_last_of(__str.data(), __pos, __str.size()); } -: 4436: -: 4437: /** -: 4438: * @brief Find last position of a character of C substring. -: 4439: * @param __s C string containing characters to locate. -: 4440: * @param __pos Index of character to search back from. -: 4441: * @param __n Number of characters from s to search for. -: 4442: * @return Index of last occurrence. -: 4443: * -: 4444: * Starting from @a __pos, searches backward for one of the -: 4445: * first @a __n characters of @a __s within this string. If -: 4446: * found, returns the index where it was found. If not found, -: 4447: * returns npos. -: 4448: */ -: 4449: size_type -: 4450: find_last_of(const _CharT* __s, size_type __pos, size_type __n) const; -: 4451: -: 4452: /** -: 4453: * @brief Find last position of a character of C string. -: 4454: * @param __s C string containing characters to locate. -: 4455: * @param __pos Index of character to search back from (default end). -: 4456: * @return Index of last occurrence. -: 4457: * -: 4458: * Starting from @a __pos, searches backward for one of the -: 4459: * characters of @a __s within this string. If found, returns -: 4460: * the index where it was found. If not found, returns npos. -: 4461: */ -: 4462: size_type -: 4463: find_last_of(const _CharT* __s, size_type __pos = npos) const -: 4464: { -: 4465: __glibcxx_requires_string(__s); -: 4466: return this->find_last_of(__s, __pos, traits_type::length(__s)); -: 4467: } -: 4468: -: 4469: /** -: 4470: * @brief Find last position of a character. -: 4471: * @param __c Character to locate. -: 4472: * @param __pos Index of character to search back from (default end). -: 4473: * @return Index of last occurrence. -: 4474: * -: 4475: * Starting from @a __pos, searches backward for @a __c within -: 4476: * this string. If found, returns the index where it was -: 4477: * found. If not found, returns npos. -: 4478: * -: 4479: * Note: equivalent to rfind(__c, __pos). -: 4480: */ -: 4481: size_type -: 4482: find_last_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT -: 4483: { return this->rfind(__c, __pos); } -: 4484: -: 4485: /** -: 4486: * @brief Find position of a character not in string. -: 4487: * @param __str String containing characters to avoid. -: 4488: * @param __pos Index of character to search from (default 0). -: 4489: * @return Index of first occurrence. -: 4490: * -: 4491: * Starting from @a __pos, searches forward for a character not contained -: 4492: * in @a __str within this string. If found, returns the index where it -: 4493: * was found. If not found, returns npos. -: 4494: */ -: 4495: size_type -: 4496: find_first_not_of(const basic_string& __str, size_type __pos = 0) const -: 4497: _GLIBCXX_NOEXCEPT -: 4498: { return this->find_first_not_of(__str.data(), __pos, __str.size()); } -: 4499: -: 4500: /** -: 4501: * @brief Find position of a character not in C substring. -: 4502: * @param __s C string containing characters to avoid. -: 4503: * @param __pos Index of character to search from. -: 4504: * @param __n Number of characters from __s to consider. -: 4505: * @return Index of first occurrence. -: 4506: * -: 4507: * Starting from @a __pos, searches forward for a character not -: 4508: * contained in the first @a __n characters of @a __s within -: 4509: * this string. If found, returns the index where it was -: 4510: * found. If not found, returns npos. -: 4511: */ -: 4512: size_type -: 4513: find_first_not_of(const _CharT* __s, size_type __pos, -: 4514: size_type __n) const; -: 4515: -: 4516: /** -: 4517: * @brief Find position of a character not in C string. -: 4518: * @param __s C string containing characters to avoid. -: 4519: * @param __pos Index of character to search from (default 0). -: 4520: * @return Index of first occurrence. -: 4521: * -: 4522: * Starting from @a __pos, searches forward for a character not -: 4523: * contained in @a __s within this string. If found, returns -: 4524: * the index where it was found. If not found, returns npos. -: 4525: */ -: 4526: size_type -: 4527: find_first_not_of(const _CharT* __s, size_type __pos = 0) const -: 4528: { -: 4529: __glibcxx_requires_string(__s); -: 4530: return this->find_first_not_of(__s, __pos, traits_type::length(__s)); -: 4531: } -: 4532: -: 4533: /** -: 4534: * @brief Find position of a different character. -: 4535: * @param __c Character to avoid. -: 4536: * @param __pos Index of character to search from (default 0). -: 4537: * @return Index of first occurrence. -: 4538: * -: 4539: * Starting from @a __pos, searches forward for a character -: 4540: * other than @a __c within this string. If found, returns the -: 4541: * index where it was found. If not found, returns npos. -: 4542: */ -: 4543: size_type -: 4544: find_first_not_of(_CharT __c, size_type __pos = 0) const -: 4545: _GLIBCXX_NOEXCEPT; -: 4546: -: 4547: /** -: 4548: * @brief Find last position of a character not in string. -: 4549: * @param __str String containing characters to avoid. -: 4550: * @param __pos Index of character to search back from (default end). -: 4551: * @return Index of last occurrence. -: 4552: * -: 4553: * Starting from @a __pos, searches backward for a character -: 4554: * not contained in @a __str within this string. If found, -: 4555: * returns the index where it was found. If not found, returns -: 4556: * npos. -: 4557: */ -: 4558: size_type -: 4559: find_last_not_of(const basic_string& __str, size_type __pos = npos) const -: 4560: _GLIBCXX_NOEXCEPT -: 4561: { return this->find_last_not_of(__str.data(), __pos, __str.size()); } -: 4562: -: 4563: /** -: 4564: * @brief Find last position of a character not in C substring. -: 4565: * @param __s C string containing characters to avoid. -: 4566: * @param __pos Index of character to search back from. -: 4567: * @param __n Number of characters from s to consider. -: 4568: * @return Index of last occurrence. -: 4569: * -: 4570: * Starting from @a __pos, searches backward for a character not -: 4571: * contained in the first @a __n characters of @a __s within this string. -: 4572: * If found, returns the index where it was found. If not found, -: 4573: * returns npos. -: 4574: */ -: 4575: size_type -: 4576: find_last_not_of(const _CharT* __s, size_type __pos, -: 4577: size_type __n) const; -: 4578: /** -: 4579: * @brief Find last position of a character not in C string. -: 4580: * @param __s C string containing characters to avoid. -: 4581: * @param __pos Index of character to search back from (default end). -: 4582: * @return Index of last occurrence. -: 4583: * -: 4584: * Starting from @a __pos, searches backward for a character -: 4585: * not contained in @a __s within this string. If found, -: 4586: * returns the index where it was found. If not found, returns -: 4587: * npos. -: 4588: */ -: 4589: size_type -: 4590: find_last_not_of(const _CharT* __s, size_type __pos = npos) const -: 4591: { -: 4592: __glibcxx_requires_string(__s); -: 4593: return this->find_last_not_of(__s, __pos, traits_type::length(__s)); -: 4594: } -: 4595: -: 4596: /** -: 4597: * @brief Find last position of a different character. -: 4598: * @param __c Character to avoid. -: 4599: * @param __pos Index of character to search back from (default end). -: 4600: * @return Index of last occurrence. -: 4601: * -: 4602: * Starting from @a __pos, searches backward for a character other than -: 4603: * @a __c within this string. If found, returns the index where it was -: 4604: * found. If not found, returns npos. -: 4605: */ -: 4606: size_type -: 4607: find_last_not_of(_CharT __c, size_type __pos = npos) const -: 4608: _GLIBCXX_NOEXCEPT; -: 4609: -: 4610: /** -: 4611: * @brief Get a substring. -: 4612: * @param __pos Index of first character (default 0). -: 4613: * @param __n Number of characters in substring (default remainder). -: 4614: * @return The new string. -: 4615: * @throw std::out_of_range If __pos > size(). -: 4616: * -: 4617: * Construct and return a new string using the @a __n -: 4618: * characters starting at @a __pos. If the string is too -: 4619: * short, use the remainder of the characters. If @a __pos is -: 4620: * beyond the end of the string, out_of_range is thrown. -: 4621: */ -: 4622: basic_string -: 4623: substr(size_type __pos = 0, size_type __n = npos) const -: 4624: { return basic_string(*this, -: 4625: _M_check(__pos, "basic_string::substr"), __n); } -: 4626: -: 4627: /** -: 4628: * @brief Compare to a string. -: 4629: * @param __str String to compare against. -: 4630: * @return Integer < 0, 0, or > 0. -: 4631: * -: 4632: * Returns an integer < 0 if this string is ordered before @a -: 4633: * __str, 0 if their values are equivalent, or > 0 if this -: 4634: * string is ordered after @a __str. Determines the effective -: 4635: * length rlen of the strings to compare as the smallest of -: 4636: * size() and str.size(). The function then compares the two -: 4637: * strings by calling traits::compare(data(), str.data(),rlen). -: 4638: * If the result of the comparison is nonzero returns it, -: 4639: * otherwise the shorter one is ordered first. -: 4640: */ -: 4641: int -: 4642: compare(const basic_string& __str) const -: 4643: { -: 4644: const size_type __size = this->size(); -: 4645: const size_type __osize = __str.size(); -: 4646: const size_type __len = std::min(__size, __osize); -: 4647: -: 4648: int __r = traits_type::compare(_M_data(), __str.data(), __len); -: 4649: if (!__r) -: 4650: __r = _S_compare(__size, __osize); -: 4651: return __r; -: 4652: } -: 4653: -: 4654: /** -: 4655: * @brief Compare substring to a string. -: 4656: * @param __pos Index of first character of substring. -: 4657: * @param __n Number of characters in substring. -: 4658: * @param __str String to compare against. -: 4659: * @return Integer < 0, 0, or > 0. -: 4660: * -: 4661: * Form the substring of this string from the @a __n characters -: 4662: * starting at @a __pos. Returns an integer < 0 if the -: 4663: * substring is ordered before @a __str, 0 if their values are -: 4664: * equivalent, or > 0 if the substring is ordered after @a -: 4665: * __str. Determines the effective length rlen of the strings -: 4666: * to compare as the smallest of the length of the substring -: 4667: * and @a __str.size(). The function then compares the two -: 4668: * strings by calling -: 4669: * traits::compare(substring.data(),str.data(),rlen). If the -: 4670: * result of the comparison is nonzero returns it, otherwise -: 4671: * the shorter one is ordered first. -: 4672: */ -: 4673: int -: 4674: compare(size_type __pos, size_type __n, const basic_string& __str) const; -: 4675: -: 4676: /** -: 4677: * @brief Compare substring to a substring. -: 4678: * @param __pos1 Index of first character of substring. -: 4679: * @param __n1 Number of characters in substring. -: 4680: * @param __str String to compare against. -: 4681: * @param __pos2 Index of first character of substring of str. -: 4682: * @param __n2 Number of characters in substring of str. -: 4683: * @return Integer < 0, 0, or > 0. -: 4684: * -: 4685: * Form the substring of this string from the @a __n1 -: 4686: * characters starting at @a __pos1. Form the substring of @a -: 4687: * __str from the @a __n2 characters starting at @a __pos2. -: 4688: * Returns an integer < 0 if this substring is ordered before -: 4689: * the substring of @a __str, 0 if their values are equivalent, -: 4690: * or > 0 if this substring is ordered after the substring of -: 4691: * @a __str. Determines the effective length rlen of the -: 4692: * strings to compare as the smallest of the lengths of the -: 4693: * substrings. The function then compares the two strings by -: 4694: * calling -: 4695: * traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen). -: 4696: * If the result of the comparison is nonzero returns it, -: 4697: * otherwise the shorter one is ordered first. -: 4698: */ -: 4699: int -: 4700: compare(size_type __pos1, size_type __n1, const basic_string& __str, -: 4701: size_type __pos2, size_type __n2) const; -: 4702: -: 4703: /** -: 4704: * @brief Compare to a C string. -: 4705: * @param __s C string to compare against. -: 4706: * @return Integer < 0, 0, or > 0. -: 4707: * -: 4708: * Returns an integer < 0 if this string is ordered before @a __s, 0 if -: 4709: * their values are equivalent, or > 0 if this string is ordered after -: 4710: * @a __s. Determines the effective length rlen of the strings to -: 4711: * compare as the smallest of size() and the length of a string -: 4712: * constructed from @a __s. The function then compares the two strings -: 4713: * by calling traits::compare(data(),s,rlen). If the result of the -: 4714: * comparison is nonzero returns it, otherwise the shorter one is -: 4715: * ordered first. -: 4716: */ -: 4717: int -: 4718: compare(const _CharT* __s) const; -: 4719: -: 4720: // _GLIBCXX_RESOLVE_LIB_DEFECTS -: 4721: // 5 String::compare specification questionable -: 4722: /** -: 4723: * @brief Compare substring to a C string. -: 4724: * @param __pos Index of first character of substring. -: 4725: * @param __n1 Number of characters in substring. -: 4726: * @param __s C string to compare against. -: 4727: * @return Integer < 0, 0, or > 0. -: 4728: * -: 4729: * Form the substring of this string from the @a __n1 -: 4730: * characters starting at @a pos. Returns an integer < 0 if -: 4731: * the substring is ordered before @a __s, 0 if their values -: 4732: * are equivalent, or > 0 if the substring is ordered after @a -: 4733: * __s. Determines the effective length rlen of the strings to -: 4734: * compare as the smallest of the length of the substring and -: 4735: * the length of a string constructed from @a __s. The -: 4736: * function then compares the two string by calling -: 4737: * traits::compare(substring.data(),__s,rlen). If the result of -: 4738: * the comparison is nonzero returns it, otherwise the shorter -: 4739: * one is ordered first. -: 4740: */ -: 4741: int -: 4742: compare(size_type __pos, size_type __n1, const _CharT* __s) const; -: 4743: -: 4744: /** -: 4745: * @brief Compare substring against a character %array. -: 4746: * @param __pos Index of first character of substring. -: 4747: * @param __n1 Number of characters in substring. -: 4748: * @param __s character %array to compare against. -: 4749: * @param __n2 Number of characters of s. -: 4750: * @return Integer < 0, 0, or > 0. -: 4751: * -: 4752: * Form the substring of this string from the @a __n1 -: 4753: * characters starting at @a __pos. Form a string from the -: 4754: * first @a __n2 characters of @a __s. Returns an integer < 0 -: 4755: * if this substring is ordered before the string from @a __s, -: 4756: * 0 if their values are equivalent, or > 0 if this substring -: 4757: * is ordered after the string from @a __s. Determines the -: 4758: * effective length rlen of the strings to compare as the -: 4759: * smallest of the length of the substring and @a __n2. The -: 4760: * function then compares the two strings by calling -: 4761: * traits::compare(substring.data(),s,rlen). If the result of -: 4762: * the comparison is nonzero returns it, otherwise the shorter -: 4763: * one is ordered first. -: 4764: * -: 4765: * NB: s must have at least n2 characters, '\\0' has -: 4766: * no special meaning. -: 4767: */ -: 4768: int -: 4769: compare(size_type __pos, size_type __n1, const _CharT* __s, -: 4770: size_type __n2) const; -: 4771: }; -: 4772:#endif // !_GLIBCXX_USE_CXX11_ABI -: 4773: -: 4774: // operator+ -: 4775: /** -: 4776: * @brief Concatenate two strings. -: 4777: * @param __lhs First string. -: 4778: * @param __rhs Last string. -: 4779: * @return New string with value of @a __lhs followed by @a __rhs. -: 4780: */ -: 4781: template -: 4782: basic_string<_CharT, _Traits, _Alloc> -: 4783: operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, -: 4784: const basic_string<_CharT, _Traits, _Alloc>& __rhs) -: 4785: { -: 4786: basic_string<_CharT, _Traits, _Alloc> __str(__lhs); -: 4787: __str.append(__rhs); -: 4788: return __str; -: 4789: } -: 4790: -: 4791: /** -: 4792: * @brief Concatenate C string and string. -: 4793: * @param __lhs First string. -: 4794: * @param __rhs Last string. -: 4795: * @return New string with value of @a __lhs followed by @a __rhs. -: 4796: */ -: 4797: template -: 4798: basic_string<_CharT,_Traits,_Alloc> -: 4799: operator+(const _CharT* __lhs, -: 4800: const basic_string<_CharT,_Traits,_Alloc>& __rhs); -: 4801: -: 4802: /** -: 4803: * @brief Concatenate character and string. -: 4804: * @param __lhs First string. -: 4805: * @param __rhs Last string. -: 4806: * @return New string with @a __lhs followed by @a __rhs. -: 4807: */ -: 4808: template -: 4809: basic_string<_CharT,_Traits,_Alloc> -: 4810: operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs); -: 4811: -: 4812: /** -: 4813: * @brief Concatenate string and C string. -: 4814: * @param __lhs First string. -: 4815: * @param __rhs Last string. -: 4816: * @return New string with @a __lhs followed by @a __rhs. -: 4817: */ -: 4818: template -: 4819: inline basic_string<_CharT, _Traits, _Alloc> -: 4820: operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, -: 4821: const _CharT* __rhs) -: 4822: { -: 4823: basic_string<_CharT, _Traits, _Alloc> __str(__lhs); -: 4824: __str.append(__rhs); -: 4825: return __str; -: 4826: } -: 4827: -: 4828: /** -: 4829: * @brief Concatenate string and character. -: 4830: * @param __lhs First string. -: 4831: * @param __rhs Last string. -: 4832: * @return New string with @a __lhs followed by @a __rhs. -: 4833: */ -: 4834: template -: 4835: inline basic_string<_CharT, _Traits, _Alloc> -: 4836: operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) -: 4837: { -: 4838: typedef basic_string<_CharT, _Traits, _Alloc> __string_type; -: 4839: typedef typename __string_type::size_type __size_type; -: 4840: __string_type __str(__lhs); -: 4841: __str.append(__size_type(1), __rhs); -: 4842: return __str; -: 4843: } -: 4844: -: 4845:#if __cplusplus >= 201103L -: 4846: template -: 4847: inline basic_string<_CharT, _Traits, _Alloc> function _ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_RKS8_ called 22 returned 100% blocks executed 100% 22: 4848: operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, -: 4849: const basic_string<_CharT, _Traits, _Alloc>& __rhs) 22: 4850: { return std::move(__lhs.append(__rhs)); } call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% call 6 returned 100% -: 4851: -: 4852: template -: 4853: inline basic_string<_CharT, _Traits, _Alloc> -: 4854: operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, -: 4855: basic_string<_CharT, _Traits, _Alloc>&& __rhs) -: 4856: { return std::move(__rhs.insert(0, __lhs)); } -: 4857: -: 4858: template -: 4859: inline basic_string<_CharT, _Traits, _Alloc> -: 4860: operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, -: 4861: basic_string<_CharT, _Traits, _Alloc>&& __rhs) -: 4862: { -: 4863: const auto __size = __lhs.size() + __rhs.size(); -: 4864: const bool __cond = (__size > __lhs.capacity() -: 4865: && __size <= __rhs.capacity()); -: 4866: return __cond ? std::move(__rhs.insert(0, __lhs)) -: 4867: : std::move(__lhs.append(__rhs)); -: 4868: } -: 4869: -: 4870: template -: 4871: inline basic_string<_CharT, _Traits, _Alloc> function _ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_OS8_ called 20 returned 100% blocks executed 100% 20: 4872: operator+(const _CharT* __lhs, -: 4873: basic_string<_CharT, _Traits, _Alloc>&& __rhs) 20: 4874: { return std::move(__rhs.insert(0, __lhs)); } call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% -: 4875: -: 4876: template -: 4877: inline basic_string<_CharT, _Traits, _Alloc> -: 4878: operator+(_CharT __lhs, -: 4879: basic_string<_CharT, _Traits, _Alloc>&& __rhs) -: 4880: { return std::move(__rhs.insert(0, 1, __lhs)); } -: 4881: -: 4882: template -: 4883: inline basic_string<_CharT, _Traits, _Alloc> function _ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_PKS5_ called 20 returned 100% blocks executed 100% 20: 4884: operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, -: 4885: const _CharT* __rhs) 20: 4886: { return std::move(__lhs.append(__rhs)); } call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% -: 4887: -: 4888: template -: 4889: inline basic_string<_CharT, _Traits, _Alloc> -: 4890: operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, -: 4891: _CharT __rhs) -: 4892: { return std::move(__lhs.append(1, __rhs)); } -: 4893:#endif -: 4894: -: 4895: // operator == -: 4896: /** -: 4897: * @brief Test equivalence of two strings. -: 4898: * @param __lhs First string. -: 4899: * @param __rhs Second string. -: 4900: * @return True if @a __lhs.compare(@a __rhs) == 0. False otherwise. -: 4901: */ -: 4902: template -: 4903: inline bool -: 4904: operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, -: 4905: const basic_string<_CharT, _Traits, _Alloc>& __rhs) -: 4906: { return __lhs.compare(__rhs) == 0; } -: 4907: -: 4908: template -: 4909: inline -: 4910: typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, bool>::__type function _ZSteqIcEN9__gnu_cxx11__enable_ifIXsrSt9__is_charIT_E7__valueEbE6__typeERKNSt7__cxx1112basic_stringIS3_St11char_traitsIS3_ESaIS3_EEESE_ called 0 returned 0% blocks executed 0% #####: 4911: operator==(const basic_string<_CharT>& __lhs, -: 4912: const basic_string<_CharT>& __rhs) #####: 4913: { return (__lhs.size() == __rhs.size() call 0 never executed call 1 never executed call 2 never executed call 3 never executed #####: 4914: && !std::char_traits<_CharT>::compare(__lhs.data(), __rhs.data(), call 0 never executed call 1 never executed call 2 never executed call 3 never executed call 4 never executed call 5 never executed call 6 never executed #####: 4915: __lhs.size())); } branch 0 never executed branch 1 never executed branch 2 never executed branch 3 never executed -: 4916: -: 4917: /** -: 4918: * @brief Test equivalence of C string and string. -: 4919: * @param __lhs C string. -: 4920: * @param __rhs String. -: 4921: * @return True if @a __rhs.compare(@a __lhs) == 0. False otherwise. -: 4922: */ -: 4923: template -: 4924: inline bool -: 4925: operator==(const _CharT* __lhs, -: 4926: const basic_string<_CharT, _Traits, _Alloc>& __rhs) -: 4927: { return __rhs.compare(__lhs) == 0; } -: 4928: -: 4929: /** -: 4930: * @brief Test equivalence of string and C string. -: 4931: * @param __lhs String. -: 4932: * @param __rhs C string. -: 4933: * @return True if @a __lhs.compare(@a __rhs) == 0. False otherwise. -: 4934: */ -: 4935: template -: 4936: inline bool function _ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_ called 23 returned 100% blocks executed 100% function _ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_ called 0 returned 0% blocks executed 0% 23: 4937: operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, -: 4938: const _CharT* __rhs) 23: 4939: { return __lhs.compare(__rhs) == 0; } call 0 returned 100% call 1 returned 100% call 2 never executed call 3 never executed -: 4940: -: 4941: // operator != -: 4942: /** -: 4943: * @brief Test difference of two strings. -: 4944: * @param __lhs First string. -: 4945: * @param __rhs Second string. -: 4946: * @return True if @a __lhs.compare(@a __rhs) != 0. False otherwise. -: 4947: */ -: 4948: template -: 4949: inline bool -: 4950: operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, -: 4951: const basic_string<_CharT, _Traits, _Alloc>& __rhs) -: 4952: { return !(__lhs == __rhs); } -: 4953: -: 4954: /** -: 4955: * @brief Test difference of C string and string. -: 4956: * @param __lhs C string. -: 4957: * @param __rhs String. -: 4958: * @return True if @a __rhs.compare(@a __lhs) != 0. False otherwise. -: 4959: */ -: 4960: template -: 4961: inline bool -: 4962: operator!=(const _CharT* __lhs, -: 4963: const basic_string<_CharT, _Traits, _Alloc>& __rhs) -: 4964: { return !(__lhs == __rhs); } -: 4965: -: 4966: /** -: 4967: * @brief Test difference of string and C string. -: 4968: * @param __lhs String. -: 4969: * @param __rhs C string. -: 4970: * @return True if @a __lhs.compare(@a __rhs) != 0. False otherwise. -: 4971: */ -: 4972: template -: 4973: inline bool -: 4974: operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, -: 4975: const _CharT* __rhs) -: 4976: { return !(__lhs == __rhs); } -: 4977: -: 4978: // operator < -: 4979: /** -: 4980: * @brief Test if string precedes string. -: 4981: * @param __lhs First string. -: 4982: * @param __rhs Second string. -: 4983: * @return True if @a __lhs precedes @a __rhs. False otherwise. -: 4984: */ -: 4985: template -: 4986: inline bool -: 4987: operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, -: 4988: const basic_string<_CharT, _Traits, _Alloc>& __rhs) -: 4989: { return __lhs.compare(__rhs) < 0; } -: 4990: -: 4991: /** -: 4992: * @brief Test if string precedes C string. -: 4993: * @param __lhs String. -: 4994: * @param __rhs C string. -: 4995: * @return True if @a __lhs precedes @a __rhs. False otherwise. -: 4996: */ -: 4997: template -: 4998: inline bool -: 4999: operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, -: 5000: const _CharT* __rhs) -: 5001: { return __lhs.compare(__rhs) < 0; } -: 5002: -: 5003: /** -: 5004: * @brief Test if C string precedes string. -: 5005: * @param __lhs C string. -: 5006: * @param __rhs String. -: 5007: * @return True if @a __lhs precedes @a __rhs. False otherwise. -: 5008: */ -: 5009: template -: 5010: inline bool -: 5011: operator<(const _CharT* __lhs, -: 5012: const basic_string<_CharT, _Traits, _Alloc>& __rhs) -: 5013: { return __rhs.compare(__lhs) > 0; } -: 5014: -: 5015: // operator > -: 5016: /** -: 5017: * @brief Test if string follows string. -: 5018: * @param __lhs First string. -: 5019: * @param __rhs Second string. -: 5020: * @return True if @a __lhs follows @a __rhs. False otherwise. -: 5021: */ -: 5022: template -: 5023: inline bool -: 5024: operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, -: 5025: const basic_string<_CharT, _Traits, _Alloc>& __rhs) -: 5026: { return __lhs.compare(__rhs) > 0; } -: 5027: -: 5028: /** -: 5029: * @brief Test if string follows C string. -: 5030: * @param __lhs String. -: 5031: * @param __rhs C string. -: 5032: * @return True if @a __lhs follows @a __rhs. False otherwise. -: 5033: */ -: 5034: template -: 5035: inline bool -: 5036: operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, -: 5037: const _CharT* __rhs) -: 5038: { return __lhs.compare(__rhs) > 0; } -: 5039: -: 5040: /** -: 5041: * @brief Test if C string follows string. -: 5042: * @param __lhs C string. -: 5043: * @param __rhs String. -: 5044: * @return True if @a __lhs follows @a __rhs. False otherwise. -: 5045: */ -: 5046: template -: 5047: inline bool -: 5048: operator>(const _CharT* __lhs, -: 5049: const basic_string<_CharT, _Traits, _Alloc>& __rhs) -: 5050: { return __rhs.compare(__lhs) < 0; } -: 5051: -: 5052: // operator <= -: 5053: /** -: 5054: * @brief Test if string doesn't follow string. -: 5055: * @param __lhs First string. -: 5056: * @param __rhs Second string. -: 5057: * @return True if @a __lhs doesn't follow @a __rhs. False otherwise. -: 5058: */ -: 5059: template -: 5060: inline bool -: 5061: operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, -: 5062: const basic_string<_CharT, _Traits, _Alloc>& __rhs) -: 5063: { return __lhs.compare(__rhs) <= 0; } -: 5064: -: 5065: /** -: 5066: * @brief Test if string doesn't follow C string. -: 5067: * @param __lhs String. -: 5068: * @param __rhs C string. -: 5069: * @return True if @a __lhs doesn't follow @a __rhs. False otherwise. -: 5070: */ -: 5071: template -: 5072: inline bool -: 5073: operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, -: 5074: const _CharT* __rhs) -: 5075: { return __lhs.compare(__rhs) <= 0; } -: 5076: -: 5077: /** -: 5078: * @brief Test if C string doesn't follow string. -: 5079: * @param __lhs C string. -: 5080: * @param __rhs String. -: 5081: * @return True if @a __lhs doesn't follow @a __rhs. False otherwise. -: 5082: */ -: 5083: template -: 5084: inline bool -: 5085: operator<=(const _CharT* __lhs, -: 5086: const basic_string<_CharT, _Traits, _Alloc>& __rhs) -: 5087: { return __rhs.compare(__lhs) >= 0; } -: 5088: -: 5089: // operator >= -: 5090: /** -: 5091: * @brief Test if string doesn't precede string. -: 5092: * @param __lhs First string. -: 5093: * @param __rhs Second string. -: 5094: * @return True if @a __lhs doesn't precede @a __rhs. False otherwise. -: 5095: */ -: 5096: template -: 5097: inline bool -: 5098: operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, -: 5099: const basic_string<_CharT, _Traits, _Alloc>& __rhs) -: 5100: { return __lhs.compare(__rhs) >= 0; } -: 5101: -: 5102: /** -: 5103: * @brief Test if string doesn't precede C string. -: 5104: * @param __lhs String. -: 5105: * @param __rhs C string. -: 5106: * @return True if @a __lhs doesn't precede @a __rhs. False otherwise. -: 5107: */ -: 5108: template -: 5109: inline bool -: 5110: operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, -: 5111: const _CharT* __rhs) -: 5112: { return __lhs.compare(__rhs) >= 0; } -: 5113: -: 5114: /** -: 5115: * @brief Test if C string doesn't precede string. -: 5116: * @param __lhs C string. -: 5117: * @param __rhs String. -: 5118: * @return True if @a __lhs doesn't precede @a __rhs. False otherwise. -: 5119: */ -: 5120: template -: 5121: inline bool -: 5122: operator>=(const _CharT* __lhs, -: 5123: const basic_string<_CharT, _Traits, _Alloc>& __rhs) -: 5124: { return __rhs.compare(__lhs) <= 0; } -: 5125: -: 5126: /** -: 5127: * @brief Swap contents of two strings. -: 5128: * @param __lhs First string. -: 5129: * @param __rhs Second string. -: 5130: * -: 5131: * Exchanges the contents of @a __lhs and @a __rhs in constant time. -: 5132: */ -: 5133: template -: 5134: inline void -: 5135: swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, -: 5136: basic_string<_CharT, _Traits, _Alloc>& __rhs) -: 5137: { __lhs.swap(__rhs); } -: 5138: -: 5139: -: 5140: /** -: 5141: * @brief Read stream into a string. -: 5142: * @param __is Input stream. -: 5143: * @param __str Buffer to store into. -: 5144: * @return Reference to the input stream. -: 5145: * -: 5146: * Stores characters from @a __is into @a __str until whitespace is -: 5147: * found, the end of the stream is encountered, or str.max_size() -: 5148: * is reached. If is.width() is non-zero, that is the limit on the -: 5149: * number of characters stored into @a __str. Any previous -: 5150: * contents of @a __str are erased. -: 5151: */ -: 5152: template -: 5153: basic_istream<_CharT, _Traits>& -: 5154: operator>>(basic_istream<_CharT, _Traits>& __is, -: 5155: basic_string<_CharT, _Traits, _Alloc>& __str); -: 5156: -: 5157: template<> -: 5158: basic_istream& -: 5159: operator>>(basic_istream& __is, basic_string& __str); -: 5160: -: 5161: /** -: 5162: * @brief Write string to a stream. -: 5163: * @param __os Output stream. -: 5164: * @param __str String to write out. -: 5165: * @return Reference to the output stream. -: 5166: * -: 5167: * Output characters of @a __str into os following the same rules as for -: 5168: * writing a C string. -: 5169: */ -: 5170: template -: 5171: inline basic_ostream<_CharT, _Traits>& -: 5172: operator<<(basic_ostream<_CharT, _Traits>& __os, -: 5173: const basic_string<_CharT, _Traits, _Alloc>& __str) -: 5174: { -: 5175: // _GLIBCXX_RESOLVE_LIB_DEFECTS -: 5176: // 586. string inserter not a formatted function -: 5177: return __ostream_insert(__os, __str.data(), __str.size()); -: 5178: } -: 5179: -: 5180: /** -: 5181: * @brief Read a line from stream into a string. -: 5182: * @param __is Input stream. -: 5183: * @param __str Buffer to store into. -: 5184: * @param __delim Character marking end of line. -: 5185: * @return Reference to the input stream. -: 5186: * -: 5187: * Stores characters from @a __is into @a __str until @a __delim is -: 5188: * found, the end of the stream is encountered, or str.max_size() -: 5189: * is reached. Any previous contents of @a __str are erased. If -: 5190: * @a __delim is encountered, it is extracted but not stored into -: 5191: * @a __str. -: 5192: */ -: 5193: template -: 5194: basic_istream<_CharT, _Traits>& -: 5195: getline(basic_istream<_CharT, _Traits>& __is, -: 5196: basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim); -: 5197: -: 5198: /** -: 5199: * @brief Read a line from stream into a string. -: 5200: * @param __is Input stream. -: 5201: * @param __str Buffer to store into. -: 5202: * @return Reference to the input stream. -: 5203: * -: 5204: * Stores characters from is into @a __str until '\n' is -: 5205: * found, the end of the stream is encountered, or str.max_size() -: 5206: * is reached. Any previous contents of @a __str are erased. If -: 5207: * end of line is encountered, it is extracted but not stored into -: 5208: * @a __str. -: 5209: */ -: 5210: template -: 5211: inline basic_istream<_CharT, _Traits>& -: 5212: getline(basic_istream<_CharT, _Traits>& __is, -: 5213: basic_string<_CharT, _Traits, _Alloc>& __str) -: 5214: { return std::getline(__is, __str, __is.widen('\n')); } -: 5215: -: 5216:#if __cplusplus >= 201103L -: 5217: /// Read a line from an rvalue stream into a string. -: 5218: template -: 5219: inline basic_istream<_CharT, _Traits>& -: 5220: getline(basic_istream<_CharT, _Traits>&& __is, -: 5221: basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim) -: 5222: { return std::getline(__is, __str, __delim); } -: 5223: -: 5224: /// Read a line from an rvalue stream into a string. -: 5225: template -: 5226: inline basic_istream<_CharT, _Traits>& -: 5227: getline(basic_istream<_CharT, _Traits>&& __is, -: 5228: basic_string<_CharT, _Traits, _Alloc>& __str) -: 5229: { return std::getline(__is, __str); } -: 5230:#endif -: 5231: -: 5232: template<> -: 5233: basic_istream& -: 5234: getline(basic_istream& __in, basic_string& __str, -: 5235: char __delim); -: 5236: -: 5237:#ifdef _GLIBCXX_USE_WCHAR_T -: 5238: template<> -: 5239: basic_istream& -: 5240: getline(basic_istream& __in, basic_string& __str, -: 5241: wchar_t __delim); -: 5242:#endif -: 5243: -: 5244:_GLIBCXX_END_NAMESPACE_VERSION -: 5245:} // namespace -: 5246: -: 5247:#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99) -: 5248: -: 5249:#include -: 5250: -: 5251:namespace std _GLIBCXX_VISIBILITY(default) -: 5252:{ -: 5253:_GLIBCXX_BEGIN_NAMESPACE_VERSION -: 5254:_GLIBCXX_BEGIN_NAMESPACE_CXX11 -: 5255: -: 5256: // 21.4 Numeric Conversions [string.conversions]. -: 5257: inline int -: 5258: stoi(const string& __str, size_t* __idx = 0, int __base = 10) -: 5259: { return __gnu_cxx::__stoa(&std::strtol, "stoi", __str.c_str(), -: 5260: __idx, __base); } -: 5261: -: 5262: inline long -: 5263: stol(const string& __str, size_t* __idx = 0, int __base = 10) -: 5264: { return __gnu_cxx::__stoa(&std::strtol, "stol", __str.c_str(), -: 5265: __idx, __base); } -: 5266: -: 5267: inline unsigned long -: 5268: stoul(const string& __str, size_t* __idx = 0, int __base = 10) -: 5269: { return __gnu_cxx::__stoa(&std::strtoul, "stoul", __str.c_str(), -: 5270: __idx, __base); } -: 5271: -: 5272: inline long long -: 5273: stoll(const string& __str, size_t* __idx = 0, int __base = 10) -: 5274: { return __gnu_cxx::__stoa(&std::strtoll, "stoll", __str.c_str(), -: 5275: __idx, __base); } -: 5276: -: 5277: inline unsigned long long -: 5278: stoull(const string& __str, size_t* __idx = 0, int __base = 10) -: 5279: { return __gnu_cxx::__stoa(&std::strtoull, "stoull", __str.c_str(), -: 5280: __idx, __base); } -: 5281: -: 5282: // NB: strtof vs strtod. -: 5283: inline float -: 5284: stof(const string& __str, size_t* __idx = 0) -: 5285: { return __gnu_cxx::__stoa(&std::strtof, "stof", __str.c_str(), __idx); } -: 5286: -: 5287: inline double -: 5288: stod(const string& __str, size_t* __idx = 0) -: 5289: { return __gnu_cxx::__stoa(&std::strtod, "stod", __str.c_str(), __idx); } -: 5290: -: 5291: inline long double -: 5292: stold(const string& __str, size_t* __idx = 0) -: 5293: { return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); } -: 5294: -: 5295: // NB: (v)snprintf vs sprintf. -: 5296: -: 5297: // DR 1261. -: 5298: inline string -: 5299: to_string(int __val) -: 5300: { return __gnu_cxx::__to_xstring(&std::vsnprintf, 4 * sizeof(int), -: 5301: "%d", __val); } -: 5302: -: 5303: inline string -: 5304: to_string(unsigned __val) -: 5305: { return __gnu_cxx::__to_xstring(&std::vsnprintf, -: 5306: 4 * sizeof(unsigned), -: 5307: "%u", __val); } -: 5308: -: 5309: inline string -: 5310: to_string(long __val) -: 5311: { return __gnu_cxx::__to_xstring(&std::vsnprintf, 4 * sizeof(long), -: 5312: "%ld", __val); } -: 5313: -: 5314: inline string -: 5315: to_string(unsigned long __val) -: 5316: { return __gnu_cxx::__to_xstring(&std::vsnprintf, -: 5317: 4 * sizeof(unsigned long), -: 5318: "%lu", __val); } -: 5319: -: 5320: inline string -: 5321: to_string(long long __val) -: 5322: { return __gnu_cxx::__to_xstring(&std::vsnprintf, -: 5323: 4 * sizeof(long long), -: 5324: "%lld", __val); } -: 5325: -: 5326: inline string -: 5327: to_string(unsigned long long __val) -: 5328: { return __gnu_cxx::__to_xstring(&std::vsnprintf, -: 5329: 4 * sizeof(unsigned long long), -: 5330: "%llu", __val); } -: 5331: -: 5332: inline string -: 5333: to_string(float __val) -: 5334: { -: 5335: const int __n = -: 5336: __gnu_cxx::__numeric_traits::__max_exponent10 + 20; -: 5337: return __gnu_cxx::__to_xstring(&std::vsnprintf, __n, -: 5338: "%f", __val); -: 5339: } -: 5340: -: 5341: inline string -: 5342: to_string(double __val) -: 5343: { -: 5344: const int __n = -: 5345: __gnu_cxx::__numeric_traits::__max_exponent10 + 20; -: 5346: return __gnu_cxx::__to_xstring(&std::vsnprintf, __n, -: 5347: "%f", __val); -: 5348: } -: 5349: -: 5350: inline string -: 5351: to_string(long double __val) -: 5352: { -: 5353: const int __n = -: 5354: __gnu_cxx::__numeric_traits::__max_exponent10 + 20; -: 5355: return __gnu_cxx::__to_xstring(&std::vsnprintf, __n, -: 5356: "%Lf", __val); -: 5357: } -: 5358: -: 5359:#ifdef _GLIBCXX_USE_WCHAR_T -: 5360: inline int -: 5361: stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) -: 5362: { return __gnu_cxx::__stoa(&std::wcstol, "stoi", __str.c_str(), -: 5363: __idx, __base); } -: 5364: -: 5365: inline long -: 5366: stol(const wstring& __str, size_t* __idx = 0, int __base = 10) -: 5367: { return __gnu_cxx::__stoa(&std::wcstol, "stol", __str.c_str(), -: 5368: __idx, __base); } -: 5369: -: 5370: inline unsigned long -: 5371: stoul(const wstring& __str, size_t* __idx = 0, int __base = 10) -: 5372: { return __gnu_cxx::__stoa(&std::wcstoul, "stoul", __str.c_str(), -: 5373: __idx, __base); } -: 5374: -: 5375: inline long long -: 5376: stoll(const wstring& __str, size_t* __idx = 0, int __base = 10) -: 5377: { return __gnu_cxx::__stoa(&std::wcstoll, "stoll", __str.c_str(), -: 5378: __idx, __base); } -: 5379: -: 5380: inline unsigned long long -: 5381: stoull(const wstring& __str, size_t* __idx = 0, int __base = 10) -: 5382: { return __gnu_cxx::__stoa(&std::wcstoull, "stoull", __str.c_str(), -: 5383: __idx, __base); } -: 5384: -: 5385: // NB: wcstof vs wcstod. -: 5386: inline float -: 5387: stof(const wstring& __str, size_t* __idx = 0) -: 5388: { return __gnu_cxx::__stoa(&std::wcstof, "stof", __str.c_str(), __idx); } -: 5389: -: 5390: inline double -: 5391: stod(const wstring& __str, size_t* __idx = 0) -: 5392: { return __gnu_cxx::__stoa(&std::wcstod, "stod", __str.c_str(), __idx); } -: 5393: -: 5394: inline long double -: 5395: stold(const wstring& __str, size_t* __idx = 0) -: 5396: { return __gnu_cxx::__stoa(&std::wcstold, "stold", __str.c_str(), __idx); } -: 5397: -: 5398:#ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF -: 5399: // DR 1261. -: 5400: inline wstring -: 5401: to_wstring(int __val) -: 5402: { return __gnu_cxx::__to_xstring(&std::vswprintf, 4 * sizeof(int), -: 5403: L"%d", __val); } -: 5404: -: 5405: inline wstring -: 5406: to_wstring(unsigned __val) -: 5407: { return __gnu_cxx::__to_xstring(&std::vswprintf, -: 5408: 4 * sizeof(unsigned), -: 5409: L"%u", __val); } -: 5410: -: 5411: inline wstring -: 5412: to_wstring(long __val) -: 5413: { return __gnu_cxx::__to_xstring(&std::vswprintf, 4 * sizeof(long), -: 5414: L"%ld", __val); } -: 5415: -: 5416: inline wstring -: 5417: to_wstring(unsigned long __val) -: 5418: { return __gnu_cxx::__to_xstring(&std::vswprintf, -: 5419: 4 * sizeof(unsigned long), -: 5420: L"%lu", __val); } -: 5421: -: 5422: inline wstring -: 5423: to_wstring(long long __val) -: 5424: { return __gnu_cxx::__to_xstring(&std::vswprintf, -: 5425: 4 * sizeof(long long), -: 5426: L"%lld", __val); } -: 5427: -: 5428: inline wstring -: 5429: to_wstring(unsigned long long __val) -: 5430: { return __gnu_cxx::__to_xstring(&std::vswprintf, -: 5431: 4 * sizeof(unsigned long long), -: 5432: L"%llu", __val); } -: 5433: -: 5434: inline wstring -: 5435: to_wstring(float __val) -: 5436: { -: 5437: const int __n = -: 5438: __gnu_cxx::__numeric_traits::__max_exponent10 + 20; -: 5439: return __gnu_cxx::__to_xstring(&std::vswprintf, __n, -: 5440: L"%f", __val); -: 5441: } -: 5442: -: 5443: inline wstring -: 5444: to_wstring(double __val) -: 5445: { -: 5446: const int __n = -: 5447: __gnu_cxx::__numeric_traits::__max_exponent10 + 20; -: 5448: return __gnu_cxx::__to_xstring(&std::vswprintf, __n, -: 5449: L"%f", __val); -: 5450: } -: 5451: -: 5452: inline wstring -: 5453: to_wstring(long double __val) -: 5454: { -: 5455: const int __n = -: 5456: __gnu_cxx::__numeric_traits::__max_exponent10 + 20; -: 5457: return __gnu_cxx::__to_xstring(&std::vswprintf, __n, -: 5458: L"%Lf", __val); -: 5459: } -: 5460:#endif // _GLIBCXX_HAVE_BROKEN_VSWPRINTF -: 5461:#endif -: 5462: -: 5463:_GLIBCXX_END_NAMESPACE_CXX11 -: 5464:_GLIBCXX_END_NAMESPACE_VERSION -: 5465:} // namespace -: 5466: -: 5467:#endif /* C++11 && _GLIBCXX_USE_C99 ... */ -: 5468: -: 5469:#if __cplusplus >= 201103L -: 5470: -: 5471:#include -: 5472: -: 5473:namespace std _GLIBCXX_VISIBILITY(default) -: 5474:{ -: 5475:_GLIBCXX_BEGIN_NAMESPACE_VERSION -: 5476: -: 5477: // DR 1182. -: 5478: -: 5479:#ifndef _GLIBCXX_COMPATIBILITY_CXX0X -: 5480: /// std::hash specialization for string. -: 5481: template<> -: 5482: struct hash -: 5483: : public __hash_base -: 5484: { -: 5485: size_t -: 5486: operator()(const string& __s) const noexcept -: 5487: { return std::_Hash_impl::hash(__s.data(), __s.length()); } -: 5488: }; -: 5489: -: 5490: template<> -: 5491: struct __is_fast_hash> : std::false_type -: 5492: { }; -: 5493: -: 5494:#ifdef _GLIBCXX_USE_WCHAR_T -: 5495: /// std::hash specialization for wstring. -: 5496: template<> -: 5497: struct hash -: 5498: : public __hash_base -: 5499: { -: 5500: size_t -: 5501: operator()(const wstring& __s) const noexcept -: 5502: { return std::_Hash_impl::hash(__s.data(), -: 5503: __s.length() * sizeof(wchar_t)); } -: 5504: }; -: 5505: -: 5506: template<> -: 5507: struct __is_fast_hash> : std::false_type -: 5508: { }; -: 5509:#endif -: 5510:#endif /* _GLIBCXX_COMPATIBILITY_CXX0X */ -: 5511: -: 5512:#ifdef _GLIBCXX_USE_C99_STDINT_TR1 -: 5513: /// std::hash specialization for u16string. -: 5514: template<> -: 5515: struct hash -: 5516: : public __hash_base -: 5517: { -: 5518: size_t -: 5519: operator()(const u16string& __s) const noexcept -: 5520: { return std::_Hash_impl::hash(__s.data(), -: 5521: __s.length() * sizeof(char16_t)); } -: 5522: }; -: 5523: -: 5524: template<> -: 5525: struct __is_fast_hash> : std::false_type -: 5526: { }; -: 5527: -: 5528: /// std::hash specialization for u32string. -: 5529: template<> -: 5530: struct hash -: 5531: : public __hash_base -: 5532: { -: 5533: size_t -: 5534: operator()(const u32string& __s) const noexcept -: 5535: { return std::_Hash_impl::hash(__s.data(), -: 5536: __s.length() * sizeof(char32_t)); } -: 5537: }; -: 5538: -: 5539: template<> -: 5540: struct __is_fast_hash> : std::false_type -: 5541: { }; -: 5542:#endif -: 5543: -: 5544:#if __cplusplus > 201103L -: 5545: -: 5546:#define __cpp_lib_string_udls 201304 -: 5547: -: 5548: inline namespace literals -: 5549: { -: 5550: inline namespace string_literals -: 5551: { -: 5552: -: 5553: _GLIBCXX_DEFAULT_ABI_TAG -: 5554: inline basic_string -: 5555: operator""s(const char* __str, size_t __len) -: 5556: { return basic_string{__str, __len}; } -: 5557: -: 5558:#ifdef _GLIBCXX_USE_WCHAR_T -: 5559: _GLIBCXX_DEFAULT_ABI_TAG -: 5560: inline basic_string -: 5561: operator""s(const wchar_t* __str, size_t __len) -: 5562: { return basic_string{__str, __len}; } -: 5563:#endif -: 5564: -: 5565:#ifdef _GLIBCXX_USE_C99_STDINT_TR1 -: 5566: _GLIBCXX_DEFAULT_ABI_TAG -: 5567: inline basic_string -: 5568: operator""s(const char16_t* __str, size_t __len) -: 5569: { return basic_string{__str, __len}; } -: 5570: -: 5571: _GLIBCXX_DEFAULT_ABI_TAG -: 5572: inline basic_string -: 5573: operator""s(const char32_t* __str, size_t __len) -: 5574: { return basic_string{__str, __len}; } -: 5575:#endif -: 5576: -: 5577: } // inline namespace string_literals -: 5578: } // inline namespace literals -: 5579: -: 5580:#endif // __cplusplus > 201103L -: 5581: -: 5582:_GLIBCXX_END_NAMESPACE_VERSION -: 5583:} // namespace std -: 5584: -: 5585:#endif // C++11 -: 5586: -: 5587:#endif /* _BASIC_STRING_H */ <<<<<< EOF # path=/home/travis/build/richelbilderbeek/AminoAcidFighter/#usr#include#x86_64-linux-gnu#qt5#QtCore#qstring.h.gcov -: 0:Source:/usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h -: 0:Programs:19 -: 1:/**************************************************************************** -: 2:** -: 3:** Copyright (C) 2015 The Qt Company Ltd. -: 4:** Contact: http://www.qt.io/licensing/ -: 5:** -: 6:** This file is part of the QtCore module of the Qt Toolkit. -: 7:** -: 8:** $QT_BEGIN_LICENSE:LGPL21$ -: 9:** Commercial License Usage -: 10:** Licensees holding valid commercial Qt licenses may use this file in -: 11:** accordance with the commercial license agreement provided with the -: 12:** Software or, alternatively, in accordance with the terms contained in -: 13:** a written agreement between you and The Qt Company. For licensing terms -: 14:** and conditions see http://www.qt.io/terms-conditions. For further -: 15:** information use the contact form at http://www.qt.io/contact-us. -: 16:** -: 17:** GNU Lesser General Public License Usage -: 18:** Alternatively, this file may be used under the terms of the GNU Lesser -: 19:** General Public License version 2.1 or version 3 as published by the Free -: 20:** Software Foundation and appearing in the file LICENSE.LGPLv21 and -: 21:** LICENSE.LGPLv3 included in the packaging of this file. Please review the -: 22:** following information to ensure the GNU Lesser General Public License -: 23:** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -: 24:** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -: 25:** -: 26:** As a special exception, The Qt Company gives you certain additional -: 27:** rights. These rights are described in The Qt Company LGPL Exception -: 28:** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -: 29:** -: 30:** $QT_END_LICENSE$ -: 31:** -: 32:****************************************************************************/ -: 33: -: 34:#ifndef QSTRING_H -: 35:#define QSTRING_H -: 36: -: 37:#if defined(QT_NO_CAST_FROM_ASCII) && defined(QT_RESTRICTED_CAST_FROM_ASCII) -: 38:#error QT_NO_CAST_FROM_ASCII and QT_RESTRICTED_CAST_FROM_ASCII must not be defined at the same time -: 39:#endif -: 40: -: 41:#include -: 42:#include -: 43:#include -: 44:#include -: 45: -: 46:#include -: 47: -: 48:#if defined(Q_OS_ANDROID) -: 49:// std::wstring is disabled on android's glibc, as bionic lacks certain features -: 50:// that libstdc++ checks for (like mbcslen). -: 51:namespace std -: 52:{ -: 53: typedef basic_string wstring; -: 54:} -: 55:#endif -: 56: -: 57:#include -: 58: -: 59:#ifdef truncate -: 60:#error qstring.h must be included before any header file that defines truncate -: 61:#endif -: 62: -: 63:#ifdef Q_OS_MAC -: 64:Q_FORWARD_DECLARE_CF_TYPE(CFString); -: 65:# ifdef __OBJC__ -: 66:Q_FORWARD_DECLARE_OBJC_CLASS(NSString); -: 67:# endif -: 68:#endif -: 69: -: 70:QT_BEGIN_NAMESPACE -: 71: -: 72:class QCharRef; -: 73:class QRegExp; -: 74:class QRegularExpression; -: 75:class QRegularExpressionMatch; -: 76:class QString; -: 77:class QStringList; -: 78:class QTextCodec; -: 79:class QStringRef; -: 80:template class QVector; -: 81: -: 82:class QLatin1String -: 83:{ -: 84:public: -: 85: Q_DECL_CONSTEXPR inline explicit QLatin1String(const char *s) : m_size(s ? int(strlen(s)) : 0), m_data(s) {} -: 86: Q_DECL_CONSTEXPR inline explicit QLatin1String(const char *s, int sz) : m_size(sz), m_data(s) {} -: 87: inline explicit QLatin1String(const QByteArray &s) : m_size(int(qstrnlen(s.constData(), s.size()))), m_data(s.constData()) {} -: 88: -: 89: inline const char *latin1() const { return m_data; } -: 90: inline int size() const { return m_size; } -: 91: inline const char *data() const { return m_data; } -: 92: -: 93: inline bool operator==(const QString &s) const; -: 94: inline bool operator!=(const QString &s) const; -: 95: inline bool operator>(const QString &s) const; -: 96: inline bool operator<(const QString &s) const; -: 97: inline bool operator>=(const QString &s) const; -: 98: inline bool operator<=(const QString &s) const; -: 99: -: 100:#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) -: 101: inline QT_ASCII_CAST_WARN bool operator==(const char *s) const; -: 102: inline QT_ASCII_CAST_WARN bool operator!=(const char *s) const; -: 103: inline QT_ASCII_CAST_WARN bool operator<(const char *s) const; -: 104: inline QT_ASCII_CAST_WARN bool operator>(const char *s) const; -: 105: inline QT_ASCII_CAST_WARN bool operator<=(const char *s) const; -: 106: inline QT_ASCII_CAST_WARN bool operator>=(const char *s) const; -: 107: -: 108: inline QT_ASCII_CAST_WARN bool operator==(const QByteArray &s) const; -: 109: inline QT_ASCII_CAST_WARN bool operator!=(const QByteArray &s) const; -: 110: inline QT_ASCII_CAST_WARN bool operator<(const QByteArray &s) const; -: 111: inline QT_ASCII_CAST_WARN bool operator>(const QByteArray &s) const; -: 112: inline QT_ASCII_CAST_WARN bool operator<=(const QByteArray &s) const; -: 113: inline QT_ASCII_CAST_WARN bool operator>=(const QByteArray &s) const; -: 114:#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) -: 115: -: 116:private: -: 117: int m_size; -: 118: const char *m_data; -: 119:}; -: 120:Q_DECLARE_TYPEINFO(QLatin1String, Q_MOVABLE_TYPE); -: 121: -: 122:// Qt 4.x compatibility -: 123:typedef QLatin1String QLatin1Literal; -: 124: -: 125: -: 126:typedef QTypedArrayData QStringData; -: 127: -: 128:#if defined(Q_COMPILER_UNICODE_STRINGS) -: 129: -: 130:#define QT_UNICODE_LITERAL_II(str) u"" str -: 131:typedef char16_t qunicodechar; -: 132: -: 133:#elif defined(Q_OS_WIN) \ -: 134: || (defined(__SIZEOF_WCHAR_T__) && __SIZEOF_WCHAR_T__ == 2) \ -: 135: || (!defined(__SIZEOF_WCHAR_T__) && defined(WCHAR_MAX) && (WCHAR_MAX - 0 < 65536)) -: 136:// wchar_t is 2 bytes -: 137: -: 138:#if defined(Q_CC_MSVC) -: 139:# define QT_UNICODE_LITERAL_II(str) L##str -: 140:#else -: 141:# define QT_UNICODE_LITERAL_II(str) L"" str -: 142:#endif -: 143:typedef wchar_t qunicodechar; -: 144: -: 145:#else -: 146: -: 147:#define QT_NO_UNICODE_LITERAL -: 148:typedef ushort qunicodechar; -: 149: -: 150:#endif -: 151: -: 152:Q_STATIC_ASSERT_X(sizeof(qunicodechar) == 2, -: 153: "qunicodechar must typedef an integral type of size 2"); -: 154: -: 155:#ifndef QT_NO_UNICODE_LITERAL -: 156:# define QT_UNICODE_LITERAL(str) QT_UNICODE_LITERAL_II(str) -: 157:# if defined(Q_COMPILER_LAMBDA) -: 158: -: 159:# define QStringLiteral(str) \ -: 160: ([]() -> QString { \ -: 161: enum { Size = sizeof(QT_UNICODE_LITERAL(str))/2 - 1 }; \ -: 162: static const QStaticStringData qstring_literal = { \ -: 163: Q_STATIC_STRING_DATA_HEADER_INITIALIZER(Size), \ -: 164: QT_UNICODE_LITERAL(str) }; \ -: 165: QStringDataPtr holder = { qstring_literal.data_ptr() }; \ -: 166: const QString qstring_literal_temp(holder); \ -: 167: return qstring_literal_temp; \ -: 168: }()) \ -: 169: /**/ -: 170: -: 171:# endif -: 172:#endif // QT_NO_UNICODE_LITERAL -: 173: -: 174:#ifndef QStringLiteral -: 175:// no lambdas, not GCC, or GCC in C++98 mode with 4-byte wchar_t -: 176:// fallback, return a temporary QString -: 177:// source code is assumed to be encoded in UTF-8 -: 178: -: 179:# define QStringLiteral(str) QString::fromUtf8("" str "", sizeof(str) - 1) -: 180:#endif -: 181: -: 182:#define Q_STATIC_STRING_DATA_HEADER_INITIALIZER_WITH_OFFSET(size, offset) \ -: 183: { Q_REFCOUNT_INITIALIZE_STATIC, size, 0, 0, offset } \ -: 184: /**/ -: 185: -: 186:#define Q_STATIC_STRING_DATA_HEADER_INITIALIZER(size) \ -: 187: Q_STATIC_STRING_DATA_HEADER_INITIALIZER_WITH_OFFSET(size, sizeof(QStringData)) \ -: 188: /**/ -: 189: -: 190:template -: 191:struct QStaticStringData -: 192:{ -: 193: QArrayData str; -: 194: qunicodechar data[N + 1]; -: 195: -: 196: QStringData *data_ptr() const -: 197: { -: 198: Q_ASSERT(str.ref.isStatic()); -: 199: return const_cast(static_cast(&str)); -: 200: } -: 201:}; -: 202: -: 203:struct QStringDataPtr -: 204:{ -: 205: QStringData *ptr; -: 206:}; -: 207: -: 208:class Q_CORE_EXPORT QString -: 209:{ -: 210:public: -: 211: typedef QStringData Data; -: 212: -: 213: inline QString() Q_DECL_NOTHROW; -: 214: explicit QString(const QChar *unicode, int size = -1); -: 215: QString(QChar c); -: 216: QString(int size, QChar c); -: 217: inline QString(QLatin1String latin1); -: 218: inline QString(const QString &) Q_DECL_NOTHROW; -: 219: inline ~QString(); -: 220: QString &operator=(QChar c); -: 221: QString &operator=(const QString &) Q_DECL_NOTHROW; -: 222: inline QString &operator=(QLatin1String latin1); -: 223:#ifdef Q_COMPILER_RVALUE_REFS -: 224: inline QString(QString && other) Q_DECL_NOTHROW : d(other.d) { other.d = Data::sharedNull(); } -: 225: inline QString &operator=(QString &&other) Q_DECL_NOTHROW -: 226: { qSwap(d, other.d); return *this; } -: 227:#endif -: 228: inline void swap(QString &other) Q_DECL_NOTHROW { qSwap(d, other.d); } -: 229: inline int size() const { return d->size; } -: 230: inline int count() const { return d->size; } -: 231: inline int length() const; -: 232: inline bool isEmpty() const; -: 233: void resize(int size); -: 234: -: 235: QString &fill(QChar c, int size = -1); -: 236: void truncate(int pos); -: 237: void chop(int n); -: 238: -: 239: int capacity() const; -: 240: inline void reserve(int size); -: 241: inline void squeeze(); -: 242: -: 243: inline const QChar *unicode() const; -: 244: inline QChar *data(); -: 245: inline const QChar *data() const; -: 246: inline const QChar *constData() const; -: 247: -: 248: inline void detach(); -: 249: inline bool isDetached() const; -: 250: inline bool isSharedWith(const QString &other) const { return d == other.d; } -: 251: void clear(); -: 252: -: 253: inline const QChar at(int i) const; -: 254: const QChar operator[](int i) const; -: 255: QCharRef operator[](int i); -: 256: const QChar operator[](uint i) const; -: 257: QCharRef operator[](uint i); -: 258: -: 259: QString arg(qlonglong a, int fieldwidth=0, int base=10, -: 260: QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; -: 261: QString arg(qulonglong a, int fieldwidth=0, int base=10, -: 262: QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; -: 263: QString arg(long a, int fieldwidth=0, int base=10, -: 264: QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; -: 265: QString arg(ulong a, int fieldwidth=0, int base=10, -: 266: QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; -: 267: QString arg(int a, int fieldWidth = 0, int base = 10, -: 268: QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; -: 269: QString arg(uint a, int fieldWidth = 0, int base = 10, -: 270: QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; -: 271: QString arg(short a, int fieldWidth = 0, int base = 10, -: 272: QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; -: 273: QString arg(ushort a, int fieldWidth = 0, int base = 10, -: 274: QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; -: 275: QString arg(double a, int fieldWidth = 0, char fmt = 'g', int prec = -1, -: 276: QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; -: 277: QString arg(char a, int fieldWidth = 0, -: 278: QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; -: 279: QString arg(QChar a, int fieldWidth = 0, -: 280: QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; -: 281: QString arg(const QString &a, int fieldWidth = 0, -: 282: QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; -: 283: QString arg(const QString &a1, const QString &a2) const Q_REQUIRED_RESULT; -: 284: QString arg(const QString &a1, const QString &a2, const QString &a3) const Q_REQUIRED_RESULT; -: 285: QString arg(const QString &a1, const QString &a2, const QString &a3, -: 286: const QString &a4) const Q_REQUIRED_RESULT; -: 287: QString arg(const QString &a1, const QString &a2, const QString &a3, -: 288: const QString &a4, const QString &a5) const Q_REQUIRED_RESULT; -: 289: QString arg(const QString &a1, const QString &a2, const QString &a3, -: 290: const QString &a4, const QString &a5, const QString &a6) const Q_REQUIRED_RESULT; -: 291: QString arg(const QString &a1, const QString &a2, const QString &a3, -: 292: const QString &a4, const QString &a5, const QString &a6, -: 293: const QString &a7) const Q_REQUIRED_RESULT; -: 294: QString arg(const QString &a1, const QString &a2, const QString &a3, -: 295: const QString &a4, const QString &a5, const QString &a6, -: 296: const QString &a7, const QString &a8) const Q_REQUIRED_RESULT; -: 297: QString arg(const QString &a1, const QString &a2, const QString &a3, -: 298: const QString &a4, const QString &a5, const QString &a6, -: 299: const QString &a7, const QString &a8, const QString &a9) const Q_REQUIRED_RESULT; -: 300: -: 301: QString &vsprintf(const char *format, va_list ap) Q_ATTRIBUTE_FORMAT_PRINTF(2, 0); -: 302: QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); -: 303: static QString vasprintf(const char *format, va_list ap) Q_ATTRIBUTE_FORMAT_PRINTF(1, 0); -: 304: static QString asprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(1, 2); -: 305: -: 306: int indexOf(QChar c, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 307: int indexOf(const QString &s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 308: int indexOf(QLatin1String s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 309: int indexOf(const QStringRef &s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 310: int lastIndexOf(QChar c, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 311: int lastIndexOf(const QString &s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 312: int lastIndexOf(QLatin1String s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 313: int lastIndexOf(const QStringRef &s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 314: -: 315: inline bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 316: inline bool contains(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 317: inline bool contains(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 318: inline bool contains(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 319: int count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 320: int count(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 321: int count(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 322: -: 323:#ifndef QT_NO_REGEXP -: 324: int indexOf(const QRegExp &, int from = 0) const; -: 325: int lastIndexOf(const QRegExp &, int from = -1) const; -: 326: inline bool contains(const QRegExp &rx) const { return indexOf(rx) != -1; } -: 327: int count(const QRegExp &) const; -: 328: -: 329: int indexOf(QRegExp &, int from = 0) const; -: 330: int lastIndexOf(QRegExp &, int from = -1) const; -: 331: inline bool contains(QRegExp &rx) const { return indexOf(rx) != -1; } -: 332:#endif -: 333: -: 334:#ifndef QT_NO_REGULAREXPRESSION -: 335: int indexOf(const QRegularExpression &re, int from = 0) const; -: 336: int indexOf(const QRegularExpression &re, int from, QRegularExpressionMatch *rmatch) const; // ### Qt 6: merge overloads -: 337: int lastIndexOf(const QRegularExpression &re, int from = -1) const; -: 338: int lastIndexOf(const QRegularExpression &re, int from, QRegularExpressionMatch *rmatch) const; // ### Qt 6: merge overloads -: 339: bool contains(const QRegularExpression &re) const; -: 340: bool contains(const QRegularExpression &re, QRegularExpressionMatch *match) const; // ### Qt 6: merge overloads -: 341: int count(const QRegularExpression &re) const; -: 342:#endif -: 343: -: 344: enum SectionFlag { -: 345: SectionDefault = 0x00, -: 346: SectionSkipEmpty = 0x01, -: 347: SectionIncludeLeadingSep = 0x02, -: 348: SectionIncludeTrailingSep = 0x04, -: 349: SectionCaseInsensitiveSeps = 0x08 -: 350: }; -: 351: Q_DECLARE_FLAGS(SectionFlags, SectionFlag) -: 352: -: 353: QString section(QChar sep, int start, int end = -1, SectionFlags flags = SectionDefault) const; -: 354: QString section(const QString &in_sep, int start, int end = -1, SectionFlags flags = SectionDefault) const; -: 355:#ifndef QT_NO_REGEXP -: 356: QString section(const QRegExp ®, int start, int end = -1, SectionFlags flags = SectionDefault) const; -: 357:#endif -: 358:#ifndef QT_NO_REGULAREXPRESSION -: 359: QString section(const QRegularExpression &re, int start, int end = -1, SectionFlags flags = SectionDefault) const; -: 360:#endif -: 361: QString left(int n) const Q_REQUIRED_RESULT; -: 362: QString right(int n) const Q_REQUIRED_RESULT; -: 363: QString mid(int position, int n = -1) const Q_REQUIRED_RESULT; -: 364: QStringRef leftRef(int n) const Q_REQUIRED_RESULT; -: 365: QStringRef rightRef(int n) const Q_REQUIRED_RESULT; -: 366: QStringRef midRef(int position, int n = -1) const Q_REQUIRED_RESULT; -: 367: -: 368: bool startsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 369: bool startsWith(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 370: bool startsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 371: bool startsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 372: bool endsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 373: bool endsWith(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 374: bool endsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 375: bool endsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 376: -: 377: QString leftJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const Q_REQUIRED_RESULT; -: 378: QString rightJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const Q_REQUIRED_RESULT; -: 379: -: 380:#if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QSTRING_COMPAT_CPP) -: 381:# if defined(Q_CC_GNU) -: 382: // required due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61941 -: 383:# pragma push_macro("Q_REQUIRED_RESULT") -: 384:# undef Q_REQUIRED_RESULT -: 385:# define Q_REQUIRED_RESULT -: 386:# define Q_REQUIRED_RESULT_pushed -: 387:# endif -: 388: QString toLower() const & Q_REQUIRED_RESULT -: 389: { return toLower_helper(*this); } -: 390: QString toLower() && Q_REQUIRED_RESULT -: 391: { return toLower_helper(*this); } -: 392: QString toUpper() const & Q_REQUIRED_RESULT -: 393: { return toUpper_helper(*this); } -: 394: QString toUpper() && Q_REQUIRED_RESULT -: 395: { return toUpper_helper(*this); } -: 396: QString toCaseFolded() const & Q_REQUIRED_RESULT -: 397: { return toCaseFolded_helper(*this); } -: 398: QString toCaseFolded() && Q_REQUIRED_RESULT -: 399: { return toCaseFolded_helper(*this); } -: 400: QString trimmed() const & Q_REQUIRED_RESULT -: 401: { return trimmed_helper(*this); } -: 402: QString trimmed() && Q_REQUIRED_RESULT -: 403: { return trimmed_helper(*this); } -: 404: QString simplified() const & Q_REQUIRED_RESULT -: 405: { return simplified_helper(*this); } -: 406: QString simplified() && Q_REQUIRED_RESULT -: 407: { return simplified_helper(*this); } -: 408:# ifdef Q_REQUIRED_RESULT_pushed -: 409:# pragma pop_macro("Q_REQUIRED_RESULT") -: 410:# endif -: 411:#else -: 412: QString toLower() const Q_REQUIRED_RESULT; -: 413: QString toUpper() const Q_REQUIRED_RESULT; -: 414: QString toCaseFolded() const Q_REQUIRED_RESULT; -: 415: QString trimmed() const Q_REQUIRED_RESULT; -: 416: QString simplified() const Q_REQUIRED_RESULT; -: 417:#endif -: 418: QString toHtmlEscaped() const Q_REQUIRED_RESULT; -: 419: -: 420: QString &insert(int i, QChar c); -: 421: QString &insert(int i, const QChar *uc, int len); -: 422: inline QString &insert(int i, const QString &s) { return insert(i, s.constData(), s.length()); } -: 423: QString &insert(int i, QLatin1String s); -: 424: QString &append(QChar c); -: 425: QString &append(const QChar *uc, int len); -: 426: QString &append(const QString &s); -: 427: QString &append(const QStringRef &s); -: 428: QString &append(QLatin1String s); -: 429: inline QString &prepend(QChar c) { return insert(0, c); } -: 430: inline QString &prepend(const QString &s) { return insert(0, s); } -: 431: inline QString &prepend(QLatin1String s) { return insert(0, s); } -: 432: -: 433: inline QString &operator+=(QChar c) { -: 434: if (d->ref.isShared() || uint(d->size) + 2u > d->alloc) -: 435: reallocData(uint(d->size) + 2u, true); -: 436: d->data()[d->size++] = c.unicode(); -: 437: d->data()[d->size] = '\0'; -: 438: return *this; -: 439: } -: 440: -: 441: inline QString &operator+=(QChar::SpecialCharacter c) { return append(QChar(c)); } -: 442: inline QString &operator+=(const QString &s) { return append(s); } -: 443: inline QString &operator+=(const QStringRef &s) { return append(s); } -: 444: inline QString &operator+=(QLatin1String s) { return append(s); } -: 445: -: 446: QString &remove(int i, int len); -: 447: QString &remove(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive); -: 448: QString &remove(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive); -: 449: QString &replace(int i, int len, QChar after); -: 450: QString &replace(int i, int len, const QChar *s, int slen); -: 451: QString &replace(int i, int len, const QString &after); -: 452: QString &replace(QChar before, QChar after, Qt::CaseSensitivity cs = Qt::CaseSensitive); -: 453: QString &replace(const QChar *before, int blen, const QChar *after, int alen, Qt::CaseSensitivity cs = Qt::CaseSensitive); -: 454: QString &replace(QLatin1String before, QLatin1String after, Qt::CaseSensitivity cs = Qt::CaseSensitive); -: 455: QString &replace(QLatin1String before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive); -: 456: QString &replace(const QString &before, QLatin1String after, Qt::CaseSensitivity cs = Qt::CaseSensitive); -: 457: QString &replace(const QString &before, const QString &after, -: 458: Qt::CaseSensitivity cs = Qt::CaseSensitive); -: 459: QString &replace(QChar c, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive); -: 460: QString &replace(QChar c, QLatin1String after, Qt::CaseSensitivity cs = Qt::CaseSensitive); -: 461:#ifndef QT_NO_REGEXP -: 462: QString &replace(const QRegExp &rx, const QString &after); -: 463: inline QString &remove(const QRegExp &rx) -: 464: { return replace(rx, QString()); } -: 465:#endif -: 466:#ifndef QT_NO_REGULAREXPRESSION -: 467: QString &replace(const QRegularExpression &re, const QString &after); -: 468: inline QString &remove(const QRegularExpression &re) -: 469: { return replace(re, QString()); } -: 470:#endif -: 471: -: 472: enum SplitBehavior { KeepEmptyParts, SkipEmptyParts }; -: 473: -: 474: QStringList split(const QString &sep, SplitBehavior behavior = KeepEmptyParts, -: 475: Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT; -: 476: QVector splitRef(const QString &sep, SplitBehavior behavior = KeepEmptyParts, -: 477: Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT; -: 478: QStringList split(QChar sep, SplitBehavior behavior = KeepEmptyParts, -: 479: Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT; -: 480: QVector splitRef(QChar sep, SplitBehavior behavior = KeepEmptyParts, -: 481: Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT; -: 482:#ifndef QT_NO_REGEXP -: 483: QStringList split(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT; -: 484: QVector splitRef(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT; -: 485:#endif -: 486:#ifndef QT_NO_REGULAREXPRESSION -: 487: QStringList split(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT; -: 488: QVector splitRef(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT; -: 489:#endif -: 490: enum NormalizationForm { -: 491: NormalizationForm_D, -: 492: NormalizationForm_C, -: 493: NormalizationForm_KD, -: 494: NormalizationForm_KC -: 495: }; -: 496: QString normalized(NormalizationForm mode, QChar::UnicodeVersion version = QChar::Unicode_Unassigned) const Q_REQUIRED_RESULT; -: 497: -: 498: QString repeated(int times) const Q_REQUIRED_RESULT; -: 499: -: 500: const ushort *utf16() const; -: 501: -: 502:#if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QSTRING_COMPAT_CPP) -: 503: QByteArray toLatin1() const & Q_REQUIRED_RESULT -: 504: { return toLatin1_helper(*this); } -: 505: QByteArray toLatin1() && Q_REQUIRED_RESULT -: 506: { return toLatin1_helper_inplace(*this); } -: 507: QByteArray toUtf8() const & Q_REQUIRED_RESULT -: 508: { return toUtf8_helper(*this); } -: 509: QByteArray toUtf8() && Q_REQUIRED_RESULT -: 510: { return toUtf8_helper(*this); } -: 511: QByteArray toLocal8Bit() const & Q_REQUIRED_RESULT -: 512: { return toLocal8Bit_helper(constData(), size()); } -: 513: QByteArray toLocal8Bit() && Q_REQUIRED_RESULT -: 514: { return toLocal8Bit_helper(constData(), size()); } -: 515:#else -: 516: QByteArray toLatin1() const Q_REQUIRED_RESULT; -: 517: QByteArray toUtf8() const Q_REQUIRED_RESULT; -: 518: QByteArray toLocal8Bit() const Q_REQUIRED_RESULT; -: 519:#endif -: 520: QVector toUcs4() const Q_REQUIRED_RESULT; -: 521: -: 522: // note - this are all inline so we can benefit from strlen() compile time optimizations -: 523: static inline QString fromLatin1(const char *str, int size = -1) -: 524: { -: 525: QStringDataPtr dataPtr = { fromLatin1_helper(str, (str && size == -1) ? int(strlen(str)) : size) }; -: 526: return QString(dataPtr); -: 527: } -: 528: static inline QString fromUtf8(const char *str, int size = -1) -: 529: { -: 530: return fromUtf8_helper(str, (str && size == -1) ? int(strlen(str)) : size); -: 531: } -: 532: static inline QString fromLocal8Bit(const char *str, int size = -1) -: 533: { -: 534: return fromLocal8Bit_helper(str, (str && size == -1) ? int(strlen(str)) : size); -: 535: } -: 536: static inline QString fromLatin1(const QByteArray &str) -: 537: { return fromLatin1(str.data(), qstrnlen(str.constData(), str.size())); } -: 538: static inline QString fromUtf8(const QByteArray &str) -: 539: { return fromUtf8(str.data(), qstrnlen(str.constData(), str.size())); } -: 540: static inline QString fromLocal8Bit(const QByteArray &str) -: 541: { return fromLocal8Bit(str.data(), qstrnlen(str.constData(), str.size())); } -: 542: static QString fromUtf16(const ushort *, int size = -1); -: 543: static QString fromUcs4(const uint *, int size = -1); -: 544: static QString fromRawData(const QChar *, int size); -: 545: -: 546:#if defined(Q_COMPILER_UNICODE_STRINGS) -: 547: static QString fromUtf16(const char16_t *str, int size = -1) -: 548: { return fromUtf16(reinterpret_cast(str), size); } -: 549: static QString fromUcs4(const char32_t *str, int size = -1) -: 550: { return fromUcs4(reinterpret_cast(str), size); } -: 551:#endif -: 552: -: 553:#if QT_DEPRECATED_SINCE(5, 0) -: 554: QT_DEPRECATED static inline QString fromAscii(const char *str, int size = -1) -: 555: { return fromLatin1(str, size); } -: 556: QT_DEPRECATED static inline QString fromAscii(const QByteArray &str) -: 557: { return fromLatin1(str); } -: 558: QByteArray toAscii() const Q_REQUIRED_RESULT -: 559: { return toLatin1(); } -: 560:#endif -: 561: -: 562: inline int toWCharArray(wchar_t *array) const; -: 563: static inline QString fromWCharArray(const wchar_t *string, int size = -1) Q_REQUIRED_RESULT; -: 564: -: 565: QString &setRawData(const QChar *unicode, int size); -: 566: QString &setUnicode(const QChar *unicode, int size); -: 567: inline QString &setUtf16(const ushort *utf16, int size); -: 568: -: 569: int compare(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 570: int compare(QLatin1String other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 571: -: 572: static inline int compare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs = Qt::CaseSensitive) -: 573: { return s1.compare(s2, cs); } -: 574: -: 575: static inline int compare(const QString &s1, QLatin1String s2, -: 576: Qt::CaseSensitivity cs = Qt::CaseSensitive) -: 577: { return s1.compare(s2, cs); } -: 578: static inline int compare(QLatin1String s1, const QString &s2, -: 579: Qt::CaseSensitivity cs = Qt::CaseSensitive) -: 580: { return -s2.compare(s1, cs); } -: 581: -: 582: int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 583: static int compare(const QString &s1, const QStringRef &s2, -: 584: Qt::CaseSensitivity = Qt::CaseSensitive); -: 585: -: 586: int localeAwareCompare(const QString& s) const; -: 587: static int localeAwareCompare(const QString& s1, const QString& s2) -: 588: { return s1.localeAwareCompare(s2); } -: 589: -: 590: int localeAwareCompare(const QStringRef &s) const; -: 591: static int localeAwareCompare(const QString& s1, const QStringRef& s2); -: 592: -: 593: // ### Qt6: make inline except for the long long versions -: 594: short toShort(bool *ok=0, int base=10) const; -: 595: ushort toUShort(bool *ok=0, int base=10) const; -: 596: int toInt(bool *ok=0, int base=10) const; -: 597: uint toUInt(bool *ok=0, int base=10) const; -: 598: long toLong(bool *ok=0, int base=10) const; -: 599: ulong toULong(bool *ok=0, int base=10) const; -: 600: qlonglong toLongLong(bool *ok=0, int base=10) const; -: 601: qulonglong toULongLong(bool *ok=0, int base=10) const; -: 602: float toFloat(bool *ok=0) const; -: 603: double toDouble(bool *ok=0) const; -: 604: -: 605: QString &setNum(short, int base=10); -: 606: QString &setNum(ushort, int base=10); -: 607: QString &setNum(int, int base=10); -: 608: QString &setNum(uint, int base=10); -: 609: QString &setNum(long, int base=10); -: 610: QString &setNum(ulong, int base=10); -: 611: QString &setNum(qlonglong, int base=10); -: 612: QString &setNum(qulonglong, int base=10); -: 613: QString &setNum(float, char f='g', int prec=6); -: 614: QString &setNum(double, char f='g', int prec=6); -: 615: -: 616: static QString number(int, int base=10); -: 617: static QString number(uint, int base=10); -: 618: static QString number(long, int base=10); -: 619: static QString number(ulong, int base=10); -: 620: static QString number(qlonglong, int base=10); -: 621: static QString number(qulonglong, int base=10); -: 622: static QString number(double, char f='g', int prec=6); -: 623: -: 624: friend Q_CORE_EXPORT bool operator==(const QString &s1, const QString &s2); -: 625: friend Q_CORE_EXPORT bool operator<(const QString &s1, const QString &s2); -: 626: friend inline bool operator>(const QString &s1, const QString &s2) { return s2 < s1; } -: 627: friend inline bool operator!=(const QString &s1, const QString &s2) { return !(s1 == s2); } -: 628: friend inline bool operator<=(const QString &s1, const QString &s2) { return !(s1 > s2); } -: 629: friend inline bool operator>=(const QString &s1, const QString &s2) { return !(s1 < s2); } -: 630: -: 631: bool operator==(QLatin1String s) const; -: 632: bool operator<(QLatin1String s) const; -: 633: bool operator>(QLatin1String s) const; -: 634: inline bool operator!=(QLatin1String s) const { return !operator==(s); } -: 635: inline bool operator<=(QLatin1String s) const { return !operator>(s); } -: 636: inline bool operator>=(QLatin1String s) const { return !operator<(s); } -: 637: -: 638: // ASCII compatibility -: 639:#if defined(QT_RESTRICTED_CAST_FROM_ASCII) -: 640: template -: 641: inline QString(const char (&ch)[N]) -: 642: : d(fromAscii_helper(ch, N - 1)) -: 643: {} -: 644: template -: 645: inline QString &operator=(const char (&ch)[N]) -: 646: { return (*this = fromLatin1(ch, N - 1)); } -: 647:#endif -: 648:#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) function _ZN7QStringC2EPKc called 94 returned 100% blocks executed 75% 94: 649: inline QT_ASCII_CAST_WARN QString(const char *ch) 94: 650: : d(fromAscii_helper(ch, ch ? int(strlen(ch)) : -1)) branch 0 taken 100% (fallthrough) branch 1 taken 0% branch 2 taken 0% (fallthrough) branch 3 taken 100% call 4 returned 100% call 5 returned 100% 94: 651: {} -: 652: inline QT_ASCII_CAST_WARN QString(const QByteArray &a) -: 653: : d(fromAscii_helper(a.constData(), qstrnlen(a.constData(), a.size()))) -: 654: {} -: 655: inline QT_ASCII_CAST_WARN QString &operator=(const char *ch) -: 656: { return (*this = fromUtf8(ch)); } -: 657: inline QT_ASCII_CAST_WARN QString &operator=(const QByteArray &a) -: 658: { return (*this = fromUtf8(a)); } -: 659: inline QT_ASCII_CAST_WARN QString &operator=(char c) -: 660: { return (*this = QChar::fromLatin1(c)); } -: 661: -: 662: // these are needed, so it compiles with STL support enabled -: 663: inline QT_ASCII_CAST_WARN QString &prepend(const char *s) -: 664: { return prepend(QString::fromUtf8(s)); } -: 665: inline QT_ASCII_CAST_WARN QString &prepend(const QByteArray &s) -: 666: { return prepend(QString::fromUtf8(s)); } -: 667: inline QT_ASCII_CAST_WARN QString &append(const char *s) -: 668: { return append(QString::fromUtf8(s)); } -: 669: inline QT_ASCII_CAST_WARN QString &append(const QByteArray &s) -: 670: { return append(QString::fromUtf8(s)); } -: 671: inline QT_ASCII_CAST_WARN QString &operator+=(const char *s) -: 672: { return append(QString::fromUtf8(s)); } -: 673: inline QT_ASCII_CAST_WARN QString &operator+=(const QByteArray &s) -: 674: { return append(QString::fromUtf8(s)); } -: 675: inline QT_ASCII_CAST_WARN QString &operator+=(char c) -: 676: { return append(QChar::fromLatin1(c)); } -: 677: -: 678: inline QT_ASCII_CAST_WARN bool operator==(const char *s) const; -: 679: inline QT_ASCII_CAST_WARN bool operator!=(const char *s) const; -: 680: inline QT_ASCII_CAST_WARN bool operator<(const char *s) const; -: 681: inline QT_ASCII_CAST_WARN bool operator<=(const char *s) const; -: 682: inline QT_ASCII_CAST_WARN bool operator>(const char *s) const; -: 683: inline QT_ASCII_CAST_WARN bool operator>=(const char *s) const; -: 684: -: 685: inline QT_ASCII_CAST_WARN bool operator==(const QByteArray &s) const; -: 686: inline QT_ASCII_CAST_WARN bool operator!=(const QByteArray &s) const; -: 687: inline QT_ASCII_CAST_WARN bool operator<(const QByteArray &s) const; -: 688: inline QT_ASCII_CAST_WARN bool operator>(const QByteArray &s) const; -: 689: inline QT_ASCII_CAST_WARN bool operator<=(const QByteArray &s) const; -: 690: inline QT_ASCII_CAST_WARN bool operator>=(const QByteArray &s) const; -: 691: -: 692: friend inline QT_ASCII_CAST_WARN bool operator==(const char *s1, const QString &s2); -: 693: friend inline QT_ASCII_CAST_WARN bool operator!=(const char *s1, const QString &s2); -: 694: friend inline QT_ASCII_CAST_WARN bool operator<(const char *s1, const QString &s2); -: 695: friend inline QT_ASCII_CAST_WARN bool operator>(const char *s1, const QString &s2); -: 696: friend inline QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QString &s2); -: 697: friend inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QString &s2); -: 698: -: 699: friend inline QT_ASCII_CAST_WARN bool operator==(const char *s1, const QStringRef &s2); -: 700: friend inline QT_ASCII_CAST_WARN bool operator!=(const char *s1, const QStringRef &s2); -: 701: friend inline QT_ASCII_CAST_WARN bool operator<(const char *s1, const QStringRef &s2); -: 702: friend inline QT_ASCII_CAST_WARN bool operator>(const char *s1, const QStringRef &s2); -: 703: friend inline QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QStringRef &s2); -: 704: friend inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QStringRef &s2); -: 705:#endif -: 706: -: 707: typedef QChar *iterator; -: 708: typedef const QChar *const_iterator; -: 709: typedef iterator Iterator; -: 710: typedef const_iterator ConstIterator; -: 711: iterator begin(); -: 712: const_iterator begin() const; -: 713: const_iterator cbegin() const; -: 714: const_iterator constBegin() const; -: 715: iterator end(); -: 716: const_iterator end() const; -: 717: const_iterator cend() const; -: 718: const_iterator constEnd() const; -: 719: -: 720: // STL compatibility -: 721: typedef int size_type; -: 722: typedef qptrdiff difference_type; -: 723: typedef const QChar & const_reference; -: 724: typedef QChar & reference; -: 725: typedef QChar *pointer; -: 726: typedef const QChar *const_pointer; -: 727: typedef QChar value_type; -: 728: inline void push_back(QChar c) { append(c); } -: 729: inline void push_back(const QString &s) { append(s); } -: 730: inline void push_front(QChar c) { prepend(c); } -: 731: inline void push_front(const QString &s) { prepend(s); } -: 732: -: 733: static inline QString fromStdString(const std::string &s); -: 734: inline std::string toStdString() const; -: 735: static inline QString fromStdWString(const std::wstring &s); -: 736: inline std::wstring toStdWString() const; -: 737: -: 738:#if defined(Q_COMPILER_UNICODE_STRINGS) || defined(Q_QDOC) -: 739: static inline QString fromStdU16String(const std::u16string &s); -: 740: inline std::u16string toStdU16String() const; -: 741: static inline QString fromStdU32String(const std::u32string &s); -: 742: inline std::u32string toStdU32String() const; -: 743:#endif -: 744: -: 745:#if defined(Q_OS_MAC) || defined(Q_QDOC) -: 746: static QString fromCFString(CFStringRef string); -: 747: CFStringRef toCFString() const Q_DECL_CF_RETURNS_RETAINED; -: 748:# if defined(__OBJC__) || defined(Q_QDOC) -: 749: static QString fromNSString(const NSString *string); -: 750: NSString *toNSString() const Q_DECL_NS_RETURNS_AUTORELEASED; -: 751:# endif -: 752:#endif -: 753: // compatibility -: 754: struct Null { }; -: 755: static const Null null; -: 756: inline QString(const Null &): d(Data::sharedNull()) {} -: 757: inline QString &operator=(const Null &) { *this = QString(); return *this; } -: 758: inline bool isNull() const { return d == Data::sharedNull(); } -: 759: -: 760: -: 761: bool isSimpleText() const; -: 762: bool isRightToLeft() const; -: 763: -: 764: QString(int size, Qt::Initialization); -: 765: Q_DECL_CONSTEXPR inline QString(QStringDataPtr dd) : d(dd.ptr) {} -: 766: -: 767:private: -: 768:#if defined(QT_NO_CAST_FROM_ASCII) -: 769: QString &operator+=(const char *s); -: 770: QString &operator+=(const QByteArray &s); -: 771: QString(const char *ch); -: 772: QString(const QByteArray &a); -: 773: QString &operator=(const char *ch); -: 774: QString &operator=(const QByteArray &a); -: 775:#endif -: 776: -: 777: Data *d; -: 778: -: 779: void reallocData(uint alloc, bool grow = false); -: 780: void expand(int i); -: 781: QString multiArg(int numArgs, const QString **args) const; -: 782: static int compare_helper(const QChar *data1, int length1, -: 783: const QChar *data2, int length2, -: 784: Qt::CaseSensitivity cs = Qt::CaseSensitive); -: 785: static int compare_helper(const QChar *data1, int length1, -: 786: const char *data2, int length2, -: 787: Qt::CaseSensitivity cs = Qt::CaseSensitive); -: 788: static int compare_helper(const QChar *data1, int length1, -: 789: QLatin1String s2, -: 790: Qt::CaseSensitivity cs = Qt::CaseSensitive); -: 791: static int localeAwareCompare_helper(const QChar *data1, int length1, -: 792: const QChar *data2, int length2); -: 793: static QString toLower_helper(const QString &str); -: 794: static QString toLower_helper(QString &str); -: 795: static QString toUpper_helper(const QString &str); -: 796: static QString toUpper_helper(QString &str); -: 797: static QString toCaseFolded_helper(const QString &str); -: 798: static QString toCaseFolded_helper(QString &str); -: 799: static QString trimmed_helper(const QString &str); -: 800: static QString trimmed_helper(QString &str); -: 801: static QString simplified_helper(const QString &str); -: 802: static QString simplified_helper(QString &str); -: 803: static Data *fromLatin1_helper(const char *str, int size = -1); -: 804: static Data *fromAscii_helper(const char *str, int size = -1); -: 805: static QString fromUtf8_helper(const char *str, int size); -: 806: static QString fromLocal8Bit_helper(const char *, int size); -: 807: static QByteArray toLatin1_helper(const QString &); -: 808: static QByteArray toLatin1_helper(const QChar *data, int size); -: 809: static QByteArray toLatin1_helper_inplace(QString &); -: 810: static QByteArray toUtf8_helper(const QString &); -: 811: static QByteArray toLocal8Bit_helper(const QChar *data, int size); -: 812: static int toUcs4_helper(const ushort *uc, int length, uint *out); -: 813: static qlonglong toIntegral_helper(const QChar *data, int len, bool *ok, int base); -: 814: static qulonglong toIntegral_helper(const QChar *data, uint len, bool *ok, int base); -: 815: void replace_helper(uint *indices, int nIndices, int blen, const QChar *after, int alen); -: 816: friend class QCharRef; -: 817: friend class QTextCodec; -: 818: friend class QStringRef; -: 819: friend class QByteArray; -: 820: friend class QCollator; -: 821: friend struct QAbstractConcatenable; -: 822: -: 823: template static -: 824: T toIntegral_helper(const QChar *data, int len, bool *ok, int base) -: 825: { -: 826: // ### Qt6: use std::conditional::value, qulonglong, qlonglong>::type -: 827: const bool isUnsigned = T(0) < T(-1); -: 828: typedef typename QtPrivate::QConditional::Type Int64; -: 829: typedef typename QtPrivate::QConditional::Type Int32; -: 830: -: 831: // we select the right overload by casting size() to int or uint -: 832: Int64 val = toIntegral_helper(data, Int32(len), ok, base); -: 833: if (T(val) != val) { -: 834: if (ok) -: 835: *ok = false; -: 836: val = 0; -: 837: } -: 838: return T(val); -: 839: } -: 840: -: 841:public: -: 842: typedef Data * DataPtr; -: 843: inline DataPtr &data_ptr() { return d; } -: 844:}; -: 845: -: 846:inline QString::QString(QLatin1String aLatin1) : d(fromLatin1_helper(aLatin1.latin1(), aLatin1.size())) -: 847:{ } -: 848:inline int QString::length() const -: 849:{ return d->size; } -: 850:inline const QChar QString::at(int i) const -: 851:{ Q_ASSERT(uint(i) < uint(size())); return d->data()[i]; } -: 852:inline const QChar QString::operator[](int i) const -: 853:{ Q_ASSERT(uint(i) < uint(size())); return d->data()[i]; } -: 854:inline const QChar QString::operator[](uint i) const -: 855:{ Q_ASSERT(i < uint(size())); return d->data()[i]; } -: 856:inline bool QString::isEmpty() const -: 857:{ return d->size == 0; } -: 858:inline const QChar *QString::unicode() const -: 859:{ return reinterpret_cast(d->data()); } -: 860:inline const QChar *QString::data() const -: 861:{ return reinterpret_cast(d->data()); } -: 862:inline QChar *QString::data() -: 863:{ detach(); return reinterpret_cast(d->data()); } -: 864:inline const QChar *QString::constData() const -: 865:{ return reinterpret_cast(d->data()); } -: 866:inline void QString::detach() -: 867:{ if (d->ref.isShared() || (d->offset != sizeof(QStringData))) reallocData(uint(d->size) + 1u); } -: 868:inline bool QString::isDetached() const -: 869:{ return !d->ref.isShared(); } -: 870:inline QString &QString::operator=(QLatin1String s) -: 871:{ -: 872: *this = fromLatin1(s.latin1(), s.size()); -: 873: return *this; -: 874:} -: 875:inline void QString::clear() -: 876:{ if (!isNull()) *this = QString(); } -: 877:inline QString::QString(const QString &other) Q_DECL_NOTHROW : d(other.d) -: 878:{ Q_ASSERT(&other != this); d->ref.ref(); } -: 879:inline int QString::capacity() const -: 880:{ return d->alloc ? d->alloc - 1 : 0; } -: 881:inline QString &QString::setNum(short n, int base) -: 882:{ return setNum(qlonglong(n), base); } -: 883:inline QString &QString::setNum(ushort n, int base) -: 884:{ return setNum(qulonglong(n), base); } -: 885:inline QString &QString::setNum(int n, int base) -: 886:{ return setNum(qlonglong(n), base); } -: 887:inline QString &QString::setNum(uint n, int base) -: 888:{ return setNum(qulonglong(n), base); } -: 889:inline QString &QString::setNum(long n, int base) -: 890:{ return setNum(qlonglong(n), base); } -: 891:inline QString &QString::setNum(ulong n, int base) -: 892:{ return setNum(qulonglong(n), base); } -: 893:inline QString &QString::setNum(float n, char f, int prec) -: 894:{ return setNum(double(n),f,prec); } -: 895:inline QString QString::arg(int a, int fieldWidth, int base, QChar fillChar) const -: 896:{ return arg(qlonglong(a), fieldWidth, base, fillChar); } -: 897:inline QString QString::arg(uint a, int fieldWidth, int base, QChar fillChar) const -: 898:{ return arg(qulonglong(a), fieldWidth, base, fillChar); } -: 899:inline QString QString::arg(long a, int fieldWidth, int base, QChar fillChar) const -: 900:{ return arg(qlonglong(a), fieldWidth, base, fillChar); } -: 901:inline QString QString::arg(ulong a, int fieldWidth, int base, QChar fillChar) const -: 902:{ return arg(qulonglong(a), fieldWidth, base, fillChar); } -: 903:inline QString QString::arg(short a, int fieldWidth, int base, QChar fillChar) const -: 904:{ return arg(qlonglong(a), fieldWidth, base, fillChar); } -: 905:inline QString QString::arg(ushort a, int fieldWidth, int base, QChar fillChar) const -: 906:{ return arg(qulonglong(a), fieldWidth, base, fillChar); } -: 907:inline QString QString::arg(const QString &a1, const QString &a2) const -: 908:{ const QString *args[2] = { &a1, &a2 }; return multiArg(2, args); } -: 909:inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3) const -: 910:{ const QString *args[3] = { &a1, &a2, &a3 }; return multiArg(3, args); } -: 911:inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3, -: 912: const QString &a4) const -: 913:{ const QString *args[4] = { &a1, &a2, &a3, &a4 }; return multiArg(4, args); } -: 914:inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3, -: 915: const QString &a4, const QString &a5) const -: 916:{ const QString *args[5] = { &a1, &a2, &a3, &a4, &a5 }; return multiArg(5, args); } -: 917:inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3, -: 918: const QString &a4, const QString &a5, const QString &a6) const -: 919:{ const QString *args[6] = { &a1, &a2, &a3, &a4, &a5, &a6 }; return multiArg(6, args); } -: 920:inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3, -: 921: const QString &a4, const QString &a5, const QString &a6, -: 922: const QString &a7) const -: 923:{ const QString *args[7] = { &a1, &a2, &a3, &a4, &a5, &a6, &a7 }; return multiArg(7, args); } -: 924:inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3, -: 925: const QString &a4, const QString &a5, const QString &a6, -: 926: const QString &a7, const QString &a8) const -: 927:{ const QString *args[8] = { &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8 }; return multiArg(8, args); } -: 928:inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3, -: 929: const QString &a4, const QString &a5, const QString &a6, -: 930: const QString &a7, const QString &a8, const QString &a9) const -: 931:{ const QString *args[9] = { &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8, &a9 }; return multiArg(9, args); } -: 932: -: 933:inline QString QString::section(QChar asep, int astart, int aend, SectionFlags aflags) const -: 934:{ return section(QString(asep), astart, aend, aflags); } -: 935: -: 936:QT_WARNING_PUSH -: 937:QT_WARNING_DISABLE_MSVC(4127) // "conditional expression is constant" -: 938: -: 939:inline int QString::toWCharArray(wchar_t *array) const -: 940:{ -: 941: if (sizeof(wchar_t) == sizeof(QChar)) { -: 942: memcpy(array, d->data(), sizeof(QChar) * size()); -: 943: return size(); -: 944: } -: 945: return toUcs4_helper(d->data(), size(), reinterpret_cast(array)); -: 946:} -: 947: -: 948:QT_WARNING_POP -: 949: -: 950:inline QString QString::fromWCharArray(const wchar_t *string, int size) -: 951:{ -: 952: return sizeof(wchar_t) == sizeof(QChar) ? fromUtf16(reinterpret_cast(string), size) -: 953: : fromUcs4(reinterpret_cast(string), size); -: 954:} -: 955: -: 956: -: 957:class Q_CORE_EXPORT QCharRef { -: 958: QString &s; -: 959: int i; -: 960: inline QCharRef(QString &str, int idx) -: 961: : s(str),i(idx) {} -: 962: friend class QString; -: 963:public: -: 964: -: 965: // most QChar operations repeated here -: 966: -: 967: // all this is not documented: We just say "like QChar" and let it be. -: 968: inline operator QChar() const -: 969: { return i < s.d->size ? s.d->data()[i] : 0; } -: 970: inline QCharRef &operator=(QChar c) -: 971: { if (i >= s.d->size) s.expand(i); else s.detach(); -: 972: s.d->data()[i] = c.unicode(); return *this; } -: 973: -: 974: // An operator= for each QChar cast constructors -: 975:#ifndef QT_NO_CAST_FROM_ASCII -: 976: inline QT_ASCII_CAST_WARN QCharRef &operator=(char c) -: 977: { return operator=(QChar::fromLatin1(c)); } -: 978: inline QT_ASCII_CAST_WARN QCharRef &operator=(uchar c) -: 979: { return operator=(QChar::fromLatin1(c)); } -: 980:#endif -: 981: inline QCharRef &operator=(const QCharRef &c) { return operator=(QChar(c)); } -: 982: inline QCharRef &operator=(ushort rc) { return operator=(QChar(rc)); } -: 983: inline QCharRef &operator=(short rc) { return operator=(QChar(rc)); } -: 984: inline QCharRef &operator=(uint rc) { return operator=(QChar(rc)); } -: 985: inline QCharRef &operator=(int rc) { return operator=(QChar(rc)); } -: 986: -: 987: // each function... -: 988: inline bool isNull() const { return QChar(*this).isNull(); } -: 989: inline bool isPrint() const { return QChar(*this).isPrint(); } -: 990: inline bool isPunct() const { return QChar(*this).isPunct(); } -: 991: inline bool isSpace() const { return QChar(*this).isSpace(); } -: 992: inline bool isMark() const { return QChar(*this).isMark(); } -: 993: inline bool isLetter() const { return QChar(*this).isLetter(); } -: 994: inline bool isNumber() const { return QChar(*this).isNumber(); } -: 995: inline bool isLetterOrNumber() { return QChar(*this).isLetterOrNumber(); } -: 996: inline bool isDigit() const { return QChar(*this).isDigit(); } -: 997: inline bool isLower() const { return QChar(*this).isLower(); } -: 998: inline bool isUpper() const { return QChar(*this).isUpper(); } -: 999: inline bool isTitleCase() const { return QChar(*this).isTitleCase(); } -: 1000: -: 1001: inline int digitValue() const { return QChar(*this).digitValue(); } -: 1002: QChar toLower() const { return QChar(*this).toLower(); } -: 1003: QChar toUpper() const { return QChar(*this).toUpper(); } -: 1004: QChar toTitleCase () const { return QChar(*this).toTitleCase(); } -: 1005: -: 1006: QChar::Category category() const { return QChar(*this).category(); } -: 1007: QChar::Direction direction() const { return QChar(*this).direction(); } -: 1008: QChar::JoiningType joiningType() const { return QChar(*this).joiningType(); } -: 1009:#if QT_DEPRECATED_SINCE(5, 3) -: 1010: QT_DEPRECATED QChar::Joining joining() const -: 1011: { -: 1012: switch (QChar(*this).joiningType()) { -: 1013: case QChar::Joining_Causing: return QChar::Center; -: 1014: case QChar::Joining_Dual: return QChar::Dual; -: 1015: case QChar::Joining_Right: return QChar::Right; -: 1016: case QChar::Joining_None: -: 1017: case QChar::Joining_Left: -: 1018: case QChar::Joining_Transparent: -: 1019: default: return QChar::OtherJoining; -: 1020: } -: 1021: } -: 1022:#endif -: 1023: bool hasMirrored() const { return QChar(*this).hasMirrored(); } -: 1024: QChar mirroredChar() const { return QChar(*this).mirroredChar(); } -: 1025: QString decomposition() const { return QChar(*this).decomposition(); } -: 1026: QChar::Decomposition decompositionTag() const { return QChar(*this).decompositionTag(); } -: 1027: uchar combiningClass() const { return QChar(*this).combiningClass(); } -: 1028: -: 1029: inline QChar::Script script() const { return QChar(*this).script(); } -: 1030: -: 1031: QChar::UnicodeVersion unicodeVersion() const { return QChar(*this).unicodeVersion(); } -: 1032: -: 1033: inline uchar cell() const { return QChar(*this).cell(); } -: 1034: inline uchar row() const { return QChar(*this).row(); } -: 1035: inline void setCell(uchar cell); -: 1036: inline void setRow(uchar row); -: 1037: -: 1038:#if QT_DEPRECATED_SINCE(5, 0) -: 1039: QT_DEPRECATED char toAscii() const { return QChar(*this).toLatin1(); } -: 1040:#endif -: 1041: char toLatin1() const { return QChar(*this).toLatin1(); } -: 1042: ushort unicode() const { return QChar(*this).unicode(); } -: 1043: ushort& unicode() { return s.data()[i].unicode(); } -: 1044: -: 1045:}; -: 1046:Q_DECLARE_TYPEINFO(QCharRef, Q_MOVABLE_TYPE); -: 1047: -: 1048:inline void QCharRef::setRow(uchar arow) { QChar(*this).setRow(arow); } -: 1049:inline void QCharRef::setCell(uchar acell) { QChar(*this).setCell(acell); } -: 1050: -: 1051: -: 1052:inline QString::QString() Q_DECL_NOTHROW : d(Data::sharedNull()) {} function _ZN7QStringD2Ev called 94 returned 100% blocks executed 100% 94: 1053:inline QString::~QString() { if (!d->ref.deref()) Data::deallocate(d); } call 0 returned 100% call 1 returned 100% call 2 returned 100% branch 3 taken 74% (fallthrough) branch 4 taken 26% call 5 returned 100% call 6 returned 100% call 7 returned 100% -: 1054: -: 1055:inline void QString::reserve(int asize) -: 1056:{ -: 1057: if (d->ref.isShared() || uint(asize) >= d->alloc) -: 1058: reallocData(qMax(asize, d->size) + 1u); -: 1059: -: 1060: if (!d->capacityReserved) { -: 1061: // cannot set unconditionally, since d could be the shared_null/shared_empty (which is const) -: 1062: d->capacityReserved = true; -: 1063: } -: 1064:} -: 1065: -: 1066:inline void QString::squeeze() -: 1067:{ -: 1068: if (d->ref.isShared() || uint(d->size) + 1u < d->alloc) -: 1069: reallocData(uint(d->size) + 1u); -: 1070: -: 1071: if (d->capacityReserved) { -: 1072: // cannot set unconditionally, since d could be shared_null or -: 1073: // otherwise static. -: 1074: d->capacityReserved = false; -: 1075: } -: 1076:} -: 1077: -: 1078:inline QString &QString::setUtf16(const ushort *autf16, int asize) -: 1079:{ return setUnicode(reinterpret_cast(autf16), asize); } -: 1080:inline QCharRef QString::operator[](int i) -: 1081:{ Q_ASSERT(i >= 0); return QCharRef(*this, i); } -: 1082:inline QCharRef QString::operator[](uint i) -: 1083:{ return QCharRef(*this, i); } -: 1084:inline QString::iterator QString::begin() -: 1085:{ detach(); return reinterpret_cast(d->data()); } -: 1086:inline QString::const_iterator QString::begin() const -: 1087:{ return reinterpret_cast(d->data()); } -: 1088:inline QString::const_iterator QString::cbegin() const -: 1089:{ return reinterpret_cast(d->data()); } -: 1090:inline QString::const_iterator QString::constBegin() const -: 1091:{ return reinterpret_cast(d->data()); } -: 1092:inline QString::iterator QString::end() -: 1093:{ detach(); return reinterpret_cast(d->data() + d->size); } -: 1094:inline QString::const_iterator QString::end() const -: 1095:{ return reinterpret_cast(d->data() + d->size); } -: 1096:inline QString::const_iterator QString::cend() const -: 1097:{ return reinterpret_cast(d->data() + d->size); } -: 1098:inline QString::const_iterator QString::constEnd() const -: 1099:{ return reinterpret_cast(d->data() + d->size); } -: 1100:inline bool QString::contains(const QString &s, Qt::CaseSensitivity cs) const -: 1101:{ return indexOf(s, 0, cs) != -1; } -: 1102:inline bool QString::contains(const QStringRef &s, Qt::CaseSensitivity cs) const -: 1103:{ return indexOf(s, 0, cs) != -1; } -: 1104:inline bool QString::contains(QLatin1String s, Qt::CaseSensitivity cs) const -: 1105:{ return indexOf(s, 0, cs) != -1; } -: 1106:inline bool QString::contains(QChar c, Qt::CaseSensitivity cs) const -: 1107:{ return indexOf(c, 0, cs) != -1; } -: 1108: -: 1109: -: 1110:inline bool operator==(QString::Null, QString::Null) { return true; } -: 1111:inline bool operator==(QString::Null, const QString &s) { return s.isNull(); } -: 1112:inline bool operator==(const QString &s, QString::Null) { return s.isNull(); } -: 1113:inline bool operator!=(QString::Null, QString::Null) { return false; } -: 1114:inline bool operator!=(QString::Null, const QString &s) { return !s.isNull(); } -: 1115:inline bool operator!=(const QString &s, QString::Null) { return !s.isNull(); } -: 1116: -: 1117:inline bool operator==(QLatin1String s1, QLatin1String s2) -: 1118:{ return (s1.size() == s2.size() && !memcmp(s1.latin1(), s2.latin1(), s1.size())); } -: 1119:inline bool operator!=(QLatin1String s1, QLatin1String s2) -: 1120:{ return (s1.size() != s2.size() || memcmp(s1.latin1(), s2.latin1(), s1.size())); } -: 1121:inline bool operator<(QLatin1String s1, QLatin1String s2) -: 1122:{ int r = memcmp(s1.latin1(), s2.latin1(), qMin(s1.size(), s2.size())); -: 1123: return (r < 0) || (r == 0 && s1.size() < s2.size()); } -: 1124:inline bool operator<=(QLatin1String s1, QLatin1String s2) -: 1125:{ int r = memcmp(s1.latin1(), s2.latin1(), qMin(s1.size(), s2.size())); -: 1126: return (r < 0) || (r == 0 && s1.size() <= s2.size()); } -: 1127:inline bool operator>(QLatin1String s1, QLatin1String s2) -: 1128:{ int r = memcmp(s1.latin1(), s2.latin1(), qMin(s1.size(), s2.size())); -: 1129: return (r > 0) || (r == 0 && s1.size() > s2.size()); } -: 1130:inline bool operator>=(QLatin1String s1, QLatin1String s2) -: 1131:{ int r = memcmp(s1.latin1(), s2.latin1(), qMin(s1.size(), s2.size())); -: 1132: return (r > 0) || (r == 0 && s1.size() >= s2.size()); } -: 1133: -: 1134:inline bool QLatin1String::operator==(const QString &s) const -: 1135:{ return s == *this; } -: 1136:inline bool QLatin1String::operator!=(const QString &s) const -: 1137:{ return s != *this; } -: 1138:inline bool QLatin1String::operator>(const QString &s) const -: 1139:{ return s < *this; } -: 1140:inline bool QLatin1String::operator<(const QString &s) const -: 1141:{ return s > *this; } -: 1142:inline bool QLatin1String::operator>=(const QString &s) const -: 1143:{ return s <= *this; } -: 1144:inline bool QLatin1String::operator<=(const QString &s) const -: 1145:{ return s >= *this; } -: 1146: -: 1147:#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) -: 1148:inline bool QString::operator==(const char *s) const -: 1149:{ return QString::compare_helper(constData(), size(), s, -1) == 0; } -: 1150:inline bool QString::operator!=(const char *s) const -: 1151:{ return QString::compare_helper(constData(), size(), s, -1) != 0; } -: 1152:inline bool QString::operator<(const char *s) const -: 1153:{ return QString::compare_helper(constData(), size(), s, -1) < 0; } -: 1154:inline bool QString::operator>(const char *s) const -: 1155:{ return QString::compare_helper(constData(), size(), s, -1) > 0; } -: 1156:inline bool QString::operator<=(const char *s) const -: 1157:{ return QString::compare_helper(constData(), size(), s, -1) <= 0; } -: 1158:inline bool QString::operator>=(const char *s) const -: 1159:{ return QString::compare_helper(constData(), size(), s, -1) >= 0; } -: 1160: -: 1161:inline QT_ASCII_CAST_WARN bool operator==(const char *s1, const QString &s2) -: 1162:{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) == 0; } -: 1163:inline QT_ASCII_CAST_WARN bool operator!=(const char *s1, const QString &s2) -: 1164:{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) != 0; } -: 1165:inline QT_ASCII_CAST_WARN bool operator<(const char *s1, const QString &s2) -: 1166:{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) > 0; } -: 1167:inline QT_ASCII_CAST_WARN bool operator>(const char *s1, const QString &s2) -: 1168:{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) < 0; } -: 1169:inline QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QString &s2) -: 1170:{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) >= 0; } -: 1171:inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QString &s2) -: 1172:{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) <= 0; } -: 1173: -: 1174:inline QT_ASCII_CAST_WARN bool operator==(const char *s1, QLatin1String s2) -: 1175:{ return QString::fromUtf8(s1) == s2; } -: 1176:inline QT_ASCII_CAST_WARN bool operator!=(const char *s1, QLatin1String s2) -: 1177:{ return QString::fromUtf8(s1) != s2; } -: 1178:inline QT_ASCII_CAST_WARN bool operator<(const char *s1, QLatin1String s2) -: 1179:{ return (QString::fromUtf8(s1) < s2); } -: 1180:inline QT_ASCII_CAST_WARN bool operator>(const char *s1, QLatin1String s2) -: 1181:{ return (QString::fromUtf8(s1) > s2); } -: 1182:inline QT_ASCII_CAST_WARN bool operator<=(const char *s1, QLatin1String s2) -: 1183:{ return (QString::fromUtf8(s1) <= s2); } -: 1184:inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, QLatin1String s2) -: 1185:{ return (QString::fromUtf8(s1) >= s2); } -: 1186: -: 1187:inline QT_ASCII_CAST_WARN bool QLatin1String::operator==(const char *s) const -: 1188:{ return QString::fromUtf8(s) == *this; } -: 1189:inline QT_ASCII_CAST_WARN bool QLatin1String::operator!=(const char *s) const -: 1190:{ return QString::fromUtf8(s) != *this; } -: 1191:inline QT_ASCII_CAST_WARN bool QLatin1String::operator<(const char *s) const -: 1192:{ return QString::fromUtf8(s) > *this; } -: 1193:inline QT_ASCII_CAST_WARN bool QLatin1String::operator>(const char *s) const -: 1194:{ return QString::fromUtf8(s) < *this; } -: 1195:inline QT_ASCII_CAST_WARN bool QLatin1String::operator<=(const char *s) const -: 1196:{ return QString::fromUtf8(s) >= *this; } -: 1197:inline QT_ASCII_CAST_WARN bool QLatin1String::operator>=(const char *s) const -: 1198:{ return QString::fromUtf8(s) <= *this; } -: 1199: -: 1200:inline QT_ASCII_CAST_WARN bool QLatin1String::operator==(const QByteArray &s) const -: 1201:{ return QString::fromUtf8(s) == *this; } -: 1202:inline QT_ASCII_CAST_WARN bool QLatin1String::operator!=(const QByteArray &s) const -: 1203:{ return QString::fromUtf8(s) != *this; } -: 1204:inline QT_ASCII_CAST_WARN bool QLatin1String::operator<(const QByteArray &s) const -: 1205:{ return QString::fromUtf8(s) > *this; } -: 1206:inline QT_ASCII_CAST_WARN bool QLatin1String::operator>(const QByteArray &s) const -: 1207:{ return QString::fromUtf8(s) < *this; } -: 1208:inline QT_ASCII_CAST_WARN bool QLatin1String::operator<=(const QByteArray &s) const -: 1209:{ return QString::fromUtf8(s) >= *this; } -: 1210:inline QT_ASCII_CAST_WARN bool QLatin1String::operator>=(const QByteArray &s) const -: 1211:{ return QString::fromUtf8(s) <= *this; } -: 1212: -: 1213:inline QT_ASCII_CAST_WARN bool QString::operator==(const QByteArray &s) const -: 1214:{ return QString::compare_helper(constData(), size(), s.constData(), qstrnlen(s.constData(), s.size())) == 0; } -: 1215:inline QT_ASCII_CAST_WARN bool QString::operator!=(const QByteArray &s) const -: 1216:{ return QString::compare_helper(constData(), size(), s.constData(), qstrnlen(s.constData(), s.size())) != 0; } -: 1217:inline QT_ASCII_CAST_WARN bool QString::operator<(const QByteArray &s) const -: 1218:{ return QString::compare_helper(constData(), size(), s.constData(), qstrnlen(s.constData(), s.size())) < 0; } -: 1219:inline QT_ASCII_CAST_WARN bool QString::operator>(const QByteArray &s) const -: 1220:{ return QString::compare_helper(constData(), size(), s.constData(), qstrnlen(s.constData(), s.size())) > 0; } -: 1221:inline QT_ASCII_CAST_WARN bool QString::operator<=(const QByteArray &s) const -: 1222:{ return QString::compare_helper(constData(), size(), s.constData(), qstrnlen(s.constData(), s.size())) <= 0; } -: 1223:inline QT_ASCII_CAST_WARN bool QString::operator>=(const QByteArray &s) const -: 1224:{ return QString::compare_helper(constData(), size(), s.constData(), qstrnlen(s.constData(), s.size())) >= 0; } -: 1225: -: 1226:inline bool QByteArray::operator==(const QString &s) const -: 1227:{ return QString::compare_helper(s.constData(), s.size(), constData(), qstrnlen(constData(), size())) == 0; } -: 1228:inline bool QByteArray::operator!=(const QString &s) const -: 1229:{ return QString::compare_helper(s.constData(), s.size(), constData(), qstrnlen(constData(), size())) != 0; } -: 1230:inline bool QByteArray::operator<(const QString &s) const -: 1231:{ return QString::compare_helper(s.constData(), s.size(), constData(), qstrnlen(constData(), size())) < 0; } -: 1232:inline bool QByteArray::operator>(const QString &s) const -: 1233:{ return QString::compare_helper(s.constData(), s.size(), constData(), qstrnlen(constData(), size())) > 0; } -: 1234:inline bool QByteArray::operator<=(const QString &s) const -: 1235:{ return QString::compare_helper(s.constData(), s.size(), constData(), qstrnlen(constData(), size())) <= 0; } -: 1236:inline bool QByteArray::operator>=(const QString &s) const -: 1237:{ return QString::compare_helper(s.constData(), s.size(), constData(), qstrnlen(constData(), size())) >= 0; } -: 1238:#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) -: 1239: -: 1240:#ifndef QT_NO_CAST_TO_ASCII -: 1241:inline QByteArray &QByteArray::append(const QString &s) -: 1242:{ return append(s.toUtf8()); } -: 1243:inline QByteArray &QByteArray::insert(int i, const QString &s) -: 1244:{ return insert(i, s.toUtf8()); } -: 1245:inline QByteArray &QByteArray::replace(char c, const QString &after) -: 1246:{ return replace(c, after.toUtf8()); } -: 1247:inline QByteArray &QByteArray::replace(const QString &before, const char *after) -: 1248:{ return replace(before.toUtf8(), after); } -: 1249:inline QByteArray &QByteArray::replace(const QString &before, const QByteArray &after) -: 1250:{ return replace(before.toUtf8(), after); } -: 1251:inline QByteArray &QByteArray::operator+=(const QString &s) -: 1252:{ return operator+=(s.toUtf8()); } -: 1253:inline int QByteArray::indexOf(const QString &s, int from) const -: 1254:{ return indexOf(s.toUtf8(), from); } -: 1255:inline int QByteArray::lastIndexOf(const QString &s, int from) const -: 1256:{ return lastIndexOf(s.toUtf8(), from); } -: 1257:#endif // QT_NO_CAST_TO_ASCII -: 1258: -: 1259:#if !defined(QT_USE_FAST_OPERATOR_PLUS) && !defined(QT_USE_QSTRINGBUILDER) -: 1260:inline const QString operator+(const QString &s1, const QString &s2) -: 1261:{ QString t(s1); t += s2; return t; } -: 1262:inline const QString operator+(const QString &s1, QChar s2) -: 1263:{ QString t(s1); t += s2; return t; } -: 1264:inline const QString operator+(QChar s1, const QString &s2) -: 1265:{ QString t(s1); t += s2; return t; } -: 1266:# if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) -: 1267:inline QT_ASCII_CAST_WARN const QString operator+(const QString &s1, const char *s2) -: 1268:{ QString t(s1); t += QString::fromUtf8(s2); return t; } -: 1269:inline QT_ASCII_CAST_WARN const QString operator+(const char *s1, const QString &s2) -: 1270:{ QString t = QString::fromUtf8(s1); t += s2; return t; } -: 1271:inline QT_ASCII_CAST_WARN const QString operator+(char c, const QString &s) -: 1272:{ QString t = s; t.prepend(QChar::fromLatin1(c)); return t; } -: 1273:inline QT_ASCII_CAST_WARN const QString operator+(const QString &s, char c) -: 1274:{ QString t = s; t += QChar::fromLatin1(c); return t; } -: 1275:inline QT_ASCII_CAST_WARN const QString operator+(const QByteArray &ba, const QString &s) -: 1276:{ QString t = QString::fromUtf8(ba); t += s; return t; } -: 1277:inline QT_ASCII_CAST_WARN const QString operator+(const QString &s, const QByteArray &ba) -: 1278:{ QString t(s); t += QString::fromUtf8(ba); return t; } -: 1279:# endif // QT_NO_CAST_FROM_ASCII -: 1280:#endif // QT_USE_QSTRINGBUILDER -: 1281: -: 1282:inline std::string QString::toStdString() const -: 1283:{ return toUtf8().toStdString(); } -: 1284: -: 1285:inline QString QString::fromStdString(const std::string &s) -: 1286:{ return fromUtf8(s.data(), int(s.size())); } -: 1287: -: 1288:inline std::wstring QString::toStdWString() const -: 1289:{ -: 1290: std::wstring str; -: 1291: str.resize(length()); -: 1292: -: 1293:#if defined(_MSC_VER) && _MSC_VER >= 1400 -: 1294: // VS2005 crashes if the string is empty -: 1295: if (!length()) -: 1296: return str; -: 1297:#endif -: 1298: -: 1299: str.resize(toWCharArray(&(*str.begin()))); -: 1300: return str; -: 1301:} -: 1302: -: 1303:inline QString QString::fromStdWString(const std::wstring &s) -: 1304:{ return fromWCharArray(s.data(), int(s.size())); } -: 1305: -: 1306:#if defined(Q_COMPILER_UNICODE_STRINGS) -: 1307:inline QString QString::fromStdU16String(const std::u16string &s) -: 1308:{ return fromUtf16(s.data(), int(s.size())); } -: 1309: -: 1310:inline std::u16string QString::toStdU16String() const -: 1311:{ return std::u16string(reinterpret_cast(utf16()), length()); } -: 1312: -: 1313:inline QString QString::fromStdU32String(const std::u32string &s) -: 1314:{ return fromUcs4(s.data(), int(s.size())); } -: 1315: -: 1316:inline std::u32string QString::toStdU32String() const -: 1317:{ -: 1318: std::u32string u32str(length(), char32_t(0)); -: 1319: int len = toUcs4_helper(d->data(), length(), reinterpret_cast(&u32str[0])); -: 1320: u32str.resize(len); -: 1321: return u32str; -: 1322:} -: 1323:#endif -: 1324: -: 1325:#if !defined(QT_NO_DATASTREAM) || (defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)) -: 1326:Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QString &); -: 1327:Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QString &); -: 1328:#endif -: 1329: -: 1330:Q_DECLARE_SHARED(QString) -: 1331:Q_DECLARE_OPERATORS_FOR_FLAGS(QString::SectionFlags) -: 1332: -: 1333: -: 1334:class Q_CORE_EXPORT QStringRef { -: 1335: const QString *m_string; -: 1336: int m_position; -: 1337: int m_size; -: 1338:public: -: 1339: typedef QString::size_type size_type; -: 1340: typedef QString::value_type value_type; -: 1341: typedef QString::const_iterator const_iterator; -: 1342: typedef QString::const_pointer const_pointer; -: 1343: typedef QString::const_reference const_reference; -: 1344: -: 1345: // ### Qt 6: make this constructor constexpr, after the destructor is made trivial -: 1346: inline QStringRef():m_string(0), m_position(0), m_size(0){} -: 1347: inline QStringRef(const QString *string, int position, int size); -: 1348: inline QStringRef(const QString *string); -: 1349: -: 1350: // ### Qt 6: remove this copy constructor, the implicit one is fine -: 1351: inline QStringRef(const QStringRef &other) -: 1352: :m_string(other.m_string), m_position(other.m_position), m_size(other.m_size) -: 1353: {} -: 1354: -: 1355: // ### Qt 6: remove this destructor, the implicit one is fine -: 1356: inline ~QStringRef(){} -: 1357: inline const QString *string() const { return m_string; } -: 1358: inline int position() const { return m_position; } -: 1359: inline int size() const { return m_size; } -: 1360: inline int count() const { return m_size; } -: 1361: inline int length() const { return m_size; } -: 1362: -: 1363: inline QStringRef &operator=(const QStringRef &other) { -: 1364: m_string = other.m_string; m_position = other.m_position; -: 1365: m_size = other.m_size; return *this; -: 1366: } -: 1367: -: 1368: int indexOf(const QString &str, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1369: int indexOf(QChar ch, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1370: int indexOf(QLatin1String str, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1371: int indexOf(const QStringRef &str, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1372: int lastIndexOf(const QString &str, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1373: int lastIndexOf(QChar ch, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1374: int lastIndexOf(QLatin1String str, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1375: int lastIndexOf(const QStringRef &str, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1376: -: 1377: inline bool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1378: inline bool contains(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1379: inline bool contains(QLatin1String str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1380: inline bool contains(const QStringRef &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1381: -: 1382: int count(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1383: int count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1384: int count(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1385: -: 1386: QVector split(const QString &sep, QString::SplitBehavior behavior = QString::KeepEmptyParts, -: 1387: Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT; -: 1388: QVector split(QChar sep, QString::SplitBehavior behavior = QString::KeepEmptyParts, -: 1389: Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT; -: 1390: -: 1391: QStringRef left(int n) const Q_REQUIRED_RESULT; -: 1392: QStringRef right(int n) const Q_REQUIRED_RESULT; -: 1393: QStringRef mid(int pos, int n = -1) const Q_REQUIRED_RESULT; -: 1394: -: 1395: bool startsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1396: bool startsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1397: bool startsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1398: bool startsWith(const QStringRef &c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1399: -: 1400: bool endsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1401: bool endsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1402: bool endsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1403: bool endsWith(const QStringRef &c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1404: -: 1405: inline QStringRef &operator=(const QString *string); -: 1406: -: 1407: inline const QChar *unicode() const { -: 1408: if (!m_string) -: 1409: return reinterpret_cast(QString::Data::sharedNull()->data()); -: 1410: return m_string->unicode() + m_position; -: 1411: } -: 1412: inline const QChar *data() const { return unicode(); } -: 1413: inline const QChar *constData() const { return unicode(); } -: 1414: inline const QChar *begin() const { return unicode(); } -: 1415: inline const QChar *cbegin() const { return unicode(); } -: 1416: inline const QChar *end() const { return unicode() + size(); } -: 1417: inline const QChar *cend() const { return unicode() + size(); } -: 1418: -: 1419:#if QT_DEPRECATED_SINCE(5, 0) -: 1420: QT_DEPRECATED QByteArray toAscii() const Q_REQUIRED_RESULT -: 1421: { return toLatin1(); } -: 1422:#endif -: 1423: QByteArray toLatin1() const Q_REQUIRED_RESULT; -: 1424: QByteArray toUtf8() const Q_REQUIRED_RESULT; -: 1425: QByteArray toLocal8Bit() const Q_REQUIRED_RESULT; -: 1426: QVector toUcs4() const Q_REQUIRED_RESULT; -: 1427: -: 1428: inline void clear() { m_string = 0; m_position = m_size = 0; } -: 1429: QString toString() const; -: 1430: inline bool isEmpty() const { return m_size == 0; } -: 1431: inline bool isNull() const { return m_string == 0 || m_string->isNull(); } -: 1432: -: 1433: QStringRef appendTo(QString *string) const; -: 1434: -: 1435: inline const QChar at(int i) const -: 1436: { Q_ASSERT(uint(i) < uint(size())); return m_string->at(i + m_position); } -: 1437: -: 1438:#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) -: 1439: // ASCII compatibility -: 1440: inline QT_ASCII_CAST_WARN bool operator==(const char *s) const; -: 1441: inline QT_ASCII_CAST_WARN bool operator!=(const char *s) const; -: 1442: inline QT_ASCII_CAST_WARN bool operator<(const char *s) const; -: 1443: inline QT_ASCII_CAST_WARN bool operator<=(const char *s) const; -: 1444: inline QT_ASCII_CAST_WARN bool operator>(const char *s) const; -: 1445: inline QT_ASCII_CAST_WARN bool operator>=(const char *s) const; -: 1446:#endif -: 1447: -: 1448: int compare(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1449: int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1450: int compare(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; -: 1451: static int compare(const QStringRef &s1, const QString &s2, -: 1452: Qt::CaseSensitivity = Qt::CaseSensitive); -: 1453: static int compare(const QStringRef &s1, const QStringRef &s2, -: 1454: Qt::CaseSensitivity = Qt::CaseSensitive); -: 1455: static int compare(const QStringRef &s1, QLatin1String s2, -: 1456: Qt::CaseSensitivity cs = Qt::CaseSensitive); -: 1457: -: 1458: int localeAwareCompare(const QString &s) const; -: 1459: int localeAwareCompare(const QStringRef &s) const; -: 1460: static int localeAwareCompare(const QStringRef &s1, const QString &s2); -: 1461: static int localeAwareCompare(const QStringRef &s1, const QStringRef &s2); -: 1462: -: 1463: QStringRef trimmed() const Q_REQUIRED_RESULT; -: 1464: short toShort(bool *ok = 0, int base = 10) const; -: 1465: ushort toUShort(bool *ok = 0, int base = 10) const; -: 1466: int toInt(bool *ok = 0, int base = 10) const; -: 1467: uint toUInt(bool *ok = 0, int base = 10) const; -: 1468: long toLong(bool *ok = 0, int base = 10) const; -: 1469: ulong toULong(bool *ok = 0, int base = 10) const; -: 1470: qlonglong toLongLong(bool *ok = 0, int base = 10) const; -: 1471: qulonglong toULongLong(bool *ok = 0, int base = 10) const; -: 1472: float toFloat(bool *ok = 0) const; -: 1473: double toDouble(bool *ok = 0) const; -: 1474:}; -: 1475:Q_DECLARE_TYPEINFO(QStringRef, Q_PRIMITIVE_TYPE); -: 1476: -: 1477:inline QStringRef &QStringRef::operator=(const QString *aString) -: 1478:{ m_string = aString; m_position = 0; m_size = aString?aString->size():0; return *this; } -: 1479: -: 1480:inline QStringRef::QStringRef(const QString *aString, int aPosition, int aSize) -: 1481: :m_string(aString), m_position(aPosition), m_size(aSize){} -: 1482: -: 1483:inline QStringRef::QStringRef(const QString *aString) -: 1484: :m_string(aString), m_position(0), m_size(aString?aString->size() : 0){} -: 1485: -: 1486:Q_CORE_EXPORT bool operator==(const QStringRef &s1,const QStringRef &s2); -: 1487:inline bool operator!=(const QStringRef &s1,const QStringRef &s2) -: 1488:{ return !(s1 == s2); } -: 1489:Q_CORE_EXPORT bool operator==(const QString &s1,const QStringRef &s2); -: 1490:inline bool operator!=(const QString &s1,const QStringRef &s2) -: 1491:{ return !(s1 == s2); } -: 1492:inline bool operator==(const QStringRef &s1,const QString &s2) -: 1493:{ return s2 == s1; } -: 1494:inline bool operator!=(const QStringRef &s1,const QString &s2) -: 1495:{ return s2 != s1; } -: 1496:Q_CORE_EXPORT bool operator==(QLatin1String s1, const QStringRef &s2); -: 1497:inline bool operator!=(QLatin1String s1, const QStringRef &s2) -: 1498:{ return !(s1 == s2); } -: 1499:inline bool operator==(const QStringRef &s1, QLatin1String s2) -: 1500:{ return s2 == s1; } -: 1501:inline bool operator!=(const QStringRef &s1, QLatin1String s2) -: 1502:{ return s2 != s1; } -: 1503: -: 1504:Q_CORE_EXPORT bool operator<(const QStringRef &s1,const QStringRef &s2); -: 1505:inline bool operator>(const QStringRef &s1, const QStringRef &s2) -: 1506:{ return s2 < s1; } -: 1507:inline bool operator<=(const QStringRef &s1, const QStringRef &s2) -: 1508:{ return !(s1 > s2); } -: 1509:inline bool operator>=(const QStringRef &s1, const QStringRef &s2) -: 1510:{ return !(s1 < s2); } -: 1511: -: 1512:#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) -: 1513:inline QT_ASCII_CAST_WARN bool QStringRef::operator==(const char *s) const -: 1514:{ return QString::compare_helper(constData(), size(), s, -1) == 0; } -: 1515:inline QT_ASCII_CAST_WARN bool QStringRef::operator!=(const char *s) const -: 1516:{ return QString::compare_helper(constData(), size(), s, -1) != 0; } -: 1517:inline QT_ASCII_CAST_WARN bool QStringRef::operator<(const char *s) const -: 1518:{ return QString::compare_helper(constData(), size(), s, -1) < 0; } -: 1519:inline QT_ASCII_CAST_WARN bool QStringRef::operator<=(const char *s) const -: 1520:{ return QString::compare_helper(constData(), size(), s, -1) > 0; } -: 1521:inline QT_ASCII_CAST_WARN bool QStringRef::operator>(const char *s) const -: 1522:{ return QString::compare_helper(constData(), size(), s, -1) <= 0; } -: 1523:inline QT_ASCII_CAST_WARN bool QStringRef::operator>=(const char *s) const -: 1524:{ return QString::compare_helper(constData(), size(), s, -1) >= 0; } -: 1525: -: 1526:inline QT_ASCII_CAST_WARN bool operator==(const char *s1, const QStringRef &s2) -: 1527:{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) == 0; } -: 1528:inline QT_ASCII_CAST_WARN bool operator!=(const char *s1, const QStringRef &s2) -: 1529:{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) != 0; } -: 1530:inline QT_ASCII_CAST_WARN bool operator<(const char *s1, const QStringRef &s2) -: 1531:{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) < 0; } -: 1532:inline QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QStringRef &s2) -: 1533:{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) > 0; } -: 1534:inline QT_ASCII_CAST_WARN bool operator>(const char *s1, const QStringRef &s2) -: 1535:{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) <= 0; } -: 1536:inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QStringRef &s2) -: 1537:{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) >= 0; } -: 1538:#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) -: 1539: -: 1540:inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const -: 1541:{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } -: 1542:inline int QString::compare(const QString &s1, const QStringRef &s2, Qt::CaseSensitivity cs) -: 1543:{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } -: 1544:inline int QStringRef::compare(const QString &s, Qt::CaseSensitivity cs) const -: 1545:{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } -: 1546:inline int QStringRef::compare(const QStringRef &s, Qt::CaseSensitivity cs) const -: 1547:{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } -: 1548:inline int QStringRef::compare(QLatin1String s, Qt::CaseSensitivity cs) const -: 1549:{ return QString::compare_helper(constData(), length(), s, cs); } -: 1550:inline int QStringRef::compare(const QStringRef &s1, const QString &s2, Qt::CaseSensitivity cs) -: 1551:{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } -: 1552:inline int QStringRef::compare(const QStringRef &s1, const QStringRef &s2, Qt::CaseSensitivity cs) -: 1553:{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } -: 1554:inline int QStringRef::compare(const QStringRef &s1, QLatin1String s2, Qt::CaseSensitivity cs) -: 1555:{ return QString::compare_helper(s1.constData(), s1.length(), s2, cs); } -: 1556: -: 1557:inline int QString::localeAwareCompare(const QStringRef &s) const -: 1558:{ return localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); } -: 1559:inline int QString::localeAwareCompare(const QString& s1, const QStringRef& s2) -: 1560:{ return localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); } -: 1561:inline int QStringRef::localeAwareCompare(const QString &s) const -: 1562:{ return QString::localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); } -: 1563:inline int QStringRef::localeAwareCompare(const QStringRef &s) const -: 1564:{ return QString::localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); } -: 1565:inline int QStringRef::localeAwareCompare(const QStringRef &s1, const QString &s2) -: 1566:{ return QString::localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); } -: 1567:inline int QStringRef::localeAwareCompare(const QStringRef &s1, const QStringRef &s2) -: 1568:{ return QString::localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); } -: 1569: -: 1570:inline bool QStringRef::contains(const QString &s, Qt::CaseSensitivity cs) const -: 1571:{ return indexOf(s, 0, cs) != -1; } -: 1572:inline bool QStringRef::contains(QLatin1String s, Qt::CaseSensitivity cs) const -: 1573:{ return indexOf(s, 0, cs) != -1; } -: 1574:inline bool QStringRef::contains(QChar c, Qt::CaseSensitivity cs) const -: 1575:{ return indexOf(c, 0, cs) != -1; } -: 1576:inline bool QStringRef::contains(const QStringRef &s, Qt::CaseSensitivity cs) const -: 1577:{ return indexOf(s, 0, cs) != -1; } -: 1578: -: 1579:namespace Qt { -: 1580:#if QT_DEPRECATED_SINCE(5, 0) -: 1581:QT_DEPRECATED inline QString escape(const QString &plain) { -: 1582: return plain.toHtmlEscaped(); -: 1583:} -: 1584:#endif -: 1585:} -: 1586: -: 1587:QT_END_NAMESPACE -: 1588: -: 1589:#if defined(QT_USE_FAST_OPERATOR_PLUS) || defined(QT_USE_QSTRINGBUILDER) -: 1590:#include -: 1591:#endif -: 1592: -: 1593:#endif // QSTRING_H <<<<<< EOF # path=/home/travis/build/richelbilderbeek/AminoAcidFighter/#usr#include#boost#test#utils#lazy_ostream.hpp.gcov -: 0:Source:/usr/include/boost/test/utils/lazy_ostream.hpp -: 0:Programs:19 -: 1:// (C) Copyright Gennadiy Rozental 2008. -: 2:// Distributed under the Boost Software License, Version 1.0. -: 3:// (See accompanying file LICENSE_1_0.txt or copy at -: 4:// http://www.boost.org/LICENSE_1_0.txt) -: 5: -: 6:// See http://www.boost.org/libs/test for the library home page. -: 7:// -: 8:// File : $RCSfile$ -: 9:// -: 10:// Version : $Revision$ -: 11:// -: 12:// Description : contains definition for all test tools in test toolbox -: 13:// *************************************************************************** -: 14: -: 15:#ifndef BOOST_TEST_LAZY_OSTREAM_HPP_070708GER -: 16:#define BOOST_TEST_LAZY_OSTREAM_HPP_070708GER -: 17: -: 18:// Boost.Test -: 19:#include -: 20: -: 21:// STL -: 22:#include -: 23: -: 24:#include -: 25: -: 26://____________________________________________________________________________// -: 27: -: 28:// ************************************************************************** // -: 29:// ************** lazy_ostream ************** // -: 30:// ************************************************************************** // -: 31: -: 32:namespace boost { -: 33: -: 34:namespace unit_test { -: 35: -: 36:class lazy_ostream { -: 37:public: function _ZN5boost9unit_test12lazy_ostream8instanceEv called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test12lazy_ostream8instanceEv called 204 returned 100% blocks executed 100% function _ZN5boost9unit_test12lazy_ostream8instanceEv called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test12lazy_ostream8instanceEv called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test12lazy_ostream8instanceEv called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test12lazy_ostream8instanceEv called 0 returned 0% blocks executed 0% 204: 38: static lazy_ostream& instance() { static lazy_ostream inst; return inst; } call 0 never executed branch 1 never executed branch 2 never executed call 3 never executed branch 4 never executed branch 5 never executed call 6 never executed call 7 never executed call 8 never executed call 9 never executed call 10 never executed call 11 returned 100% branch 12 taken 1% (fallthrough) branch 13 taken 99% call 14 returned 100% branch 15 taken 100% (fallthrough) branch 16 taken 0% call 17 returned 100% call 18 returned 100% call 19 returned 100% call 20 returned 100% call 21 returned 100% call 22 never executed branch 23 never executed branch 24 never executed call 25 never executed branch 26 never executed branch 27 never executed call 28 never executed call 29 never executed call 30 never executed call 31 never executed call 32 never executed call 33 never executed branch 34 never executed branch 35 never executed call 36 never executed branch 37 never executed branch 38 never executed call 39 never executed call 40 never executed call 41 never executed call 42 never executed call 43 never executed call 44 never executed branch 45 never executed branch 46 never executed call 47 never executed branch 48 never executed branch 49 never executed call 50 never executed call 51 never executed call 52 never executed call 53 never executed call 54 never executed call 55 never executed branch 56 never executed branch 57 never executed call 58 never executed branch 59 never executed branch 60 never executed call 61 never executed call 62 never executed call 63 never executed call 64 never executed call 65 never executed -: 39: -: 40: friend std::ostream& operator<<( std::ostream& ostr, lazy_ostream const& o ) { return o( ostr ); } -: 41: -: 42: // access method -: 43: bool empty() const { return m_empty; } -: 44: -: 45: // actual printing interface; to be accessed only by this class and children function _ZNK5boost9unit_test12lazy_ostreamclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test12lazy_ostreamclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test12lazy_ostreamclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test12lazy_ostreamclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test12lazy_ostreamclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test12lazy_ostreamclERSo called 0 returned 0% blocks executed 0% #####: 46: virtual std::ostream& operator()( std::ostream& ostr ) const { return ostr; } call 0 never executed call 1 never executed call 2 never executed call 3 never executed call 4 never executed call 5 never executed -: 47:protected: function _ZN5boost9unit_test12lazy_ostreamC2Eb called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test12lazy_ostreamC2Eb called 205 returned 100% blocks executed 100% function _ZN5boost9unit_test12lazy_ostreamC2Eb called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test12lazy_ostreamC2Eb called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test12lazy_ostreamC2Eb called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test12lazy_ostreamC2Eb called 0 returned 0% blocks executed 0% 205: 48: explicit lazy_ostream( bool empty = true ) : m_empty( empty ) {} call 0 never executed call 1 never executed call 2 never executed call 3 never executed call 4 returned 100% call 5 returned 100% call 6 returned 100% call 7 returned 100% call 8 never executed call 9 never executed call 10 never executed call 11 never executed call 12 never executed call 13 never executed call 14 never executed call 15 never executed call 16 never executed call 17 never executed call 18 never executed call 19 never executed call 20 never executed call 21 never executed call 22 never executed call 23 never executed -: 49: -: 50: // protected destructor to make sure right one is called -: 51:#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) -: 52:public: -: 53:#endif function _ZN5boost9unit_test12lazy_ostreamD0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test12lazy_ostreamD2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test12lazy_ostreamD0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test12lazy_ostreamD2Ev called 205 returned 100% blocks executed 80% function _ZN5boost9unit_test12lazy_ostreamD0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test12lazy_ostreamD2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test12lazy_ostreamD0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test12lazy_ostreamD2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test12lazy_ostreamD0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test12lazy_ostreamD2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test12lazy_ostreamD0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test12lazy_ostreamD2Ev called 0 returned 0% blocks executed 0% 205: 54: BOOST_TEST_PROTECTED_VIRTUAL ~lazy_ostream() {} call 0 never executed call 1 never executed call 2 never executed call 3 never executed branch 4 never executed branch 5 never executed call 6 never executed call 7 never executed call 8 never executed call 9 returned 100% call 10 returned 100% branch 11 taken 0% (fallthrough) branch 12 taken 100% call 13 never executed call 14 never executed call 15 never executed call 16 never executed call 17 never executed branch 18 never executed branch 19 never executed call 20 never executed call 21 never executed call 22 never executed call 23 never executed call 24 never executed branch 25 never executed branch 26 never executed call 27 never executed call 28 never executed call 29 never executed call 30 never executed call 31 never executed branch 32 never executed branch 33 never executed call 34 never executed call 35 never executed call 36 never executed call 37 never executed call 38 never executed branch 39 never executed branch 40 never executed call 41 never executed -: 55: -: 56:private: -: 57: // Data members -: 58: bool m_empty; -: 59:}; -: 60: -: 61://____________________________________________________________________________// -: 62: -: 63:template function _ZN5boost9unit_test17lazy_ostream_implIRKNS0_13basic_cstringIKcEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS0_13basic_cstringIKcEEED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA1_KcED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA1_KcED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIdEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIdEEED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA1_KcED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA1_KcED2Ev called 54 returned 100% blocks executed 89% function _ZN5boost9unit_test17lazy_ostream_implIRA43_KcED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA43_KcED2Ev called 1 returned 100% blocks executed 89% function _ZN5boost9unit_test17lazy_ostream_implIRA39_KcED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA39_KcED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA8_cEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA8_cEEED2Ev called 6 returned 100% blocks executed 89% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA10_cEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA10_cEEED2Ev called 4 returned 100% blocks executed 89% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEED2Ev called 23 returned 100% blocks executed 89% function _ZN5boost9unit_test17lazy_ostream_implIRKNS0_13basic_cstringIKcEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS0_13basic_cstringIKcEEED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA1_KcED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA1_KcED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA44_KcED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA44_KcED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA42_KcED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA42_KcED2Ev called 7 returned 100% blocks executed 89% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIlEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIlEEED2Ev called 2 returned 100% blocks executed 89% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIiEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIiEEED2Ev called 3 returned 100% blocks executed 89% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tImEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tImEEED2Ev called 1 returned 100% blocks executed 89% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIbEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIbEEED2Ev called 8 returned 100% blocks executed 89% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIdEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIdEEED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS0_13basic_cstringIKcEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS0_13basic_cstringIKcEEED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA44_KcED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA44_KcED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA42_KcED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA42_KcED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS0_13basic_cstringIKcEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS0_13basic_cstringIKcEEED2Ev called 32 returned 100% blocks executed 89% function _ZN5boost9unit_test17lazy_ostream_implIRA1_KcED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA1_KcED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA7_cEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA7_cEEED2Ev called 3 returned 100% blocks executed 89% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA10_cEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA10_cEEED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA14_cEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA14_cEEED2Ev called 3 returned 100% blocks executed 89% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA11_cEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA11_cEEED2Ev called 4 returned 100% blocks executed 89% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA9_cEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA9_cEEED2Ev called 3 returned 100% blocks executed 89% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA8_cEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA8_cEEED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA1_KcED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA1_KcED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tINS2_19percent_tolerance_tIdEEEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tINS2_19percent_tolerance_tIdEEEEED2Ev called 2 returned 100% blocks executed 89% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIdEEED0Ev called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIdEEED2Ev called 48 returned 100% blocks executed 89% 204: 64:class lazy_ostream_impl : public lazy_ostream { call 0 never executed call 1 never executed call 2 never executed call 3 never executed call 4 never executed call 5 never executed call 6 never executed call 7 never executed branch 8 never executed branch 9 never executed call 10 never executed call 11 never executed call 12 never executed call 13 never executed call 14 never executed call 15 never executed call 16 never executed call 17 never executed call 18 never executed branch 19 never executed branch 20 never executed call 21 never executed call 22 never executed call 23 never executed call 24 never executed call 25 never executed call 26 never executed call 27 never executed call 28 never executed call 29 never executed branch 30 never executed branch 31 never executed call 32 never executed call 33 never executed call 34 never executed call 35 returned 100% call 36 returned 100% call 37 returned 100% call 38 returned 100% call 39 returned 100% call 40 returned 100% branch 41 taken 0% (fallthrough) branch 42 taken 100% call 43 never executed call 44 never executed call 45 never executed call 46 returned 100% call 47 returned 100% call 48 returned 100% call 49 returned 100% call 50 returned 100% call 51 returned 100% branch 52 taken 0% (fallthrough) branch 53 taken 100% call 54 never executed call 55 never executed call 56 never executed call 57 never executed call 58 never executed call 59 never executed call 60 never executed call 61 never executed call 62 never executed branch 63 never executed branch 64 never executed call 65 never executed call 66 never executed call 67 never executed call 68 returned 100% call 69 returned 100% call 70 returned 100% call 71 returned 100% call 72 returned 100% call 73 returned 100% branch 74 taken 0% (fallthrough) branch 75 taken 100% call 76 never executed call 77 never executed call 78 never executed call 79 returned 100% call 80 returned 100% call 81 returned 100% call 82 returned 100% call 83 returned 100% call 84 returned 100% branch 85 taken 0% (fallthrough) branch 86 taken 100% call 87 never executed call 88 never executed call 89 never executed call 90 returned 100% call 91 returned 100% call 92 returned 100% call 93 returned 100% call 94 returned 100% call 95 returned 100% branch 96 taken 0% (fallthrough) branch 97 taken 100% call 98 never executed call 99 never executed call 100 never executed call 101 never executed call 102 never executed call 103 never executed call 104 never executed call 105 never executed call 106 never executed branch 107 never executed branch 108 never executed call 109 never executed call 110 never executed call 111 never executed call 112 never executed call 113 never executed call 114 never executed call 115 never executed call 116 never executed call 117 never executed branch 118 never executed branch 119 never executed call 120 never executed call 121 never executed call 122 never executed call 123 never executed call 124 never executed call 125 never executed call 126 never executed call 127 never executed call 128 never executed branch 129 never executed branch 130 never executed call 131 never executed call 132 never executed call 133 never executed call 134 returned 100% call 135 returned 100% call 136 returned 100% call 137 returned 100% call 138 returned 100% call 139 returned 100% branch 140 taken 0% (fallthrough) branch 141 taken 100% call 142 never executed call 143 never executed call 144 never executed call 145 returned 100% call 146 returned 100% call 147 returned 100% call 148 returned 100% call 149 returned 100% call 150 returned 100% branch 151 taken 0% (fallthrough) branch 152 taken 100% call 153 never executed call 154 never executed call 155 never executed call 156 returned 100% call 157 returned 100% call 158 returned 100% call 159 returned 100% call 160 returned 100% call 161 returned 100% branch 162 taken 0% (fallthrough) branch 163 taken 100% call 164 never executed call 165 never executed call 166 never executed call 167 returned 100% call 168 returned 100% call 169 returned 100% call 170 returned 100% call 171 returned 100% call 172 returned 100% branch 173 taken 0% (fallthrough) branch 174 taken 100% call 175 never executed call 176 never executed call 177 never executed call 178 returned 100% call 179 returned 100% call 180 returned 100% call 181 returned 100% call 182 returned 100% call 183 returned 100% branch 184 taken 0% (fallthrough) branch 185 taken 100% call 186 never executed call 187 never executed call 188 never executed call 189 never executed call 190 never executed call 191 never executed call 192 never executed call 193 never executed call 194 never executed branch 195 never executed branch 196 never executed call 197 never executed call 198 never executed call 199 never executed call 200 never executed call 201 never executed call 202 never executed call 203 never executed call 204 never executed call 205 never executed branch 206 never executed branch 207 never executed call 208 never executed call 209 never executed call 210 never executed call 211 never executed call 212 never executed call 213 never executed call 214 never executed call 215 never executed call 216 never executed branch 217 never executed branch 218 never executed call 219 never executed call 220 never executed call 221 never executed call 222 never executed call 223 never executed call 224 never executed call 225 never executed call 226 never executed call 227 never executed branch 228 never executed branch 229 never executed call 230 never executed call 231 never executed call 232 never executed call 233 returned 100% call 234 returned 100% call 235 returned 100% call 236 returned 100% call 237 returned 100% call 238 returned 100% branch 239 taken 0% (fallthrough) branch 240 taken 100% call 241 never executed call 242 never executed call 243 never executed call 244 never executed call 245 never executed call 246 never executed call 247 never executed call 248 never executed call 249 never executed branch 250 never executed branch 251 never executed call 252 never executed call 253 never executed call 254 never executed call 255 returned 100% call 256 returned 100% call 257 returned 100% call 258 returned 100% call 259 returned 100% call 260 returned 100% branch 261 taken 0% (fallthrough) branch 262 taken 100% call 263 never executed call 264 never executed call 265 never executed call 266 never executed call 267 never executed call 268 never executed call 269 never executed call 270 never executed call 271 never executed branch 272 never executed branch 273 never executed call 274 never executed call 275 never executed call 276 never executed call 277 returned 100% call 278 returned 100% call 279 returned 100% call 280 returned 100% call 281 returned 100% call 282 returned 100% branch 283 taken 0% (fallthrough) branch 284 taken 100% call 285 never executed call 286 never executed call 287 never executed call 288 returned 100% call 289 returned 100% call 290 returned 100% call 291 returned 100% call 292 returned 100% call 293 returned 100% branch 294 taken 0% (fallthrough) branch 295 taken 100% call 296 never executed call 297 never executed call 298 never executed call 299 returned 100% call 300 returned 100% call 301 returned 100% call 302 returned 100% call 303 returned 100% call 304 returned 100% branch 305 taken 0% (fallthrough) branch 306 taken 100% call 307 never executed call 308 never executed call 309 never executed call 310 never executed call 311 never executed call 312 never executed call 313 never executed call 314 never executed call 315 never executed branch 316 never executed branch 317 never executed call 318 never executed call 319 never executed call 320 never executed call 321 never executed call 322 never executed call 323 never executed call 324 never executed call 325 never executed call 326 never executed branch 327 never executed branch 328 never executed call 329 never executed call 330 never executed call 331 never executed call 332 never executed call 333 never executed call 334 never executed call 335 never executed call 336 never executed call 337 never executed branch 338 never executed branch 339 never executed call 340 never executed call 341 never executed call 342 never executed call 343 returned 100% call 344 returned 100% call 345 returned 100% call 346 returned 100% call 347 returned 100% call 348 returned 100% branch 349 taken 0% (fallthrough) branch 350 taken 100% call 351 never executed call 352 never executed call 353 never executed call 354 returned 100% call 355 returned 100% call 356 returned 100% call 357 returned 100% call 358 returned 100% call 359 returned 100% branch 360 taken 0% (fallthrough) branch 361 taken 100% call 362 never executed -: 65:public: function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIdEEEC2ERKNS0_12lazy_ostreamES7_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA1_KcEC2ERKNS0_12lazy_ostreamES4_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS0_13basic_cstringIKcEEEC2ERKNS0_12lazy_ostreamES6_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA8_cEEEC2ERKNS0_12lazy_ostreamES8_ called 6 returned 100% blocks executed 100% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA10_cEEEC2ERKNS0_12lazy_ostreamES8_ called 4 returned 100% blocks executed 100% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEC2ERKNS0_12lazy_ostreamESD_ called 23 returned 100% blocks executed 100% function _ZN5boost9unit_test17lazy_ostream_implIRA39_KcEC2ERKNS0_12lazy_ostreamES4_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA43_KcEC2ERKNS0_12lazy_ostreamES4_ called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test17lazy_ostream_implIRA1_KcEC2ERKNS0_12lazy_ostreamES4_ called 54 returned 100% blocks executed 100% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIlEEEC2ERKNS0_12lazy_ostreamES7_ called 2 returned 100% blocks executed 100% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIiEEEC2ERKNS0_12lazy_ostreamES7_ called 3 returned 100% blocks executed 100% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tImEEEC2ERKNS0_12lazy_ostreamES7_ called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIbEEEC2ERKNS0_12lazy_ostreamES7_ called 8 returned 100% blocks executed 100% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIdEEEC2ERKNS0_12lazy_ostreamES7_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA42_KcEC2ERKNS0_12lazy_ostreamES4_ called 7 returned 100% blocks executed 100% function _ZN5boost9unit_test17lazy_ostream_implIRA44_KcEC2ERKNS0_12lazy_ostreamES4_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA1_KcEC2ERKNS0_12lazy_ostreamES4_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS0_13basic_cstringIKcEEEC2ERKNS0_12lazy_ostreamES6_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA42_KcEC2ERKNS0_12lazy_ostreamES4_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA44_KcEC2ERKNS0_12lazy_ostreamES4_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS0_13basic_cstringIKcEEEC2ERKNS0_12lazy_ostreamES6_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA7_cEEEC2ERKNS0_12lazy_ostreamES8_ called 3 returned 100% blocks executed 100% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA10_cEEEC2ERKNS0_12lazy_ostreamES8_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA14_cEEEC2ERKNS0_12lazy_ostreamES8_ called 3 returned 100% blocks executed 100% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA11_cEEEC2ERKNS0_12lazy_ostreamES8_ called 4 returned 100% blocks executed 100% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA9_cEEEC2ERKNS0_12lazy_ostreamES8_ called 3 returned 100% blocks executed 100% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA8_cEEEC2ERKNS0_12lazy_ostreamES8_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEC2ERKNS0_12lazy_ostreamESD_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRA1_KcEC2ERKNS0_12lazy_ostreamES4_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test17lazy_ostream_implIRKNS0_13basic_cstringIKcEEEC2ERKNS0_12lazy_ostreamES6_ called 32 returned 100% blocks executed 100% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tINS2_19percent_tolerance_tIdEEEEEC2ERKNS0_12lazy_ostreamES9_ called 2 returned 100% blocks executed 100% function _ZN5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIdEEEC2ERKNS0_12lazy_ostreamES7_ called 48 returned 100% blocks executed 100% function _ZN5boost9unit_test17lazy_ostream_implIRA1_KcEC2ERKNS0_12lazy_ostreamES4_ called 0 returned 0% blocks executed 0% 204: 66: lazy_ostream_impl( lazy_ostream const& prev, T value ) -: 67: : lazy_ostream( false ) -: 68: , m_prev( prev ) 204: 69: , m_value( value ) call 0 never executed call 1 never executed call 2 never executed call 3 never executed call 4 never executed call 5 never executed call 6 never executed call 7 never executed call 8 never executed call 9 never executed call 10 never executed call 11 never executed call 12 never executed call 13 never executed call 14 never executed call 15 never executed call 16 never executed call 17 never executed call 18 never executed call 19 never executed call 20 never executed call 21 never executed call 22 never executed call 23 never executed call 24 never executed call 25 never executed call 26 never executed call 27 never executed call 28 never executed call 29 never executed call 30 never executed call 31 never executed call 32 never executed call 33 returned 100% call 34 returned 100% call 35 returned 100% call 36 returned 100% call 37 returned 100% call 38 returned 100% call 39 returned 100% call 40 returned 100% call 41 returned 100% call 42 returned 100% call 43 returned 100% call 44 returned 100% call 45 returned 100% call 46 returned 100% call 47 returned 100% call 48 returned 100% call 49 returned 100% call 50 returned 100% call 51 returned 100% call 52 returned 100% call 53 returned 100% call 54 returned 100% call 55 returned 100% call 56 returned 100% call 57 returned 100% call 58 returned 100% call 59 returned 100% call 60 returned 100% call 61 returned 100% call 62 returned 100% call 63 returned 100% call 64 returned 100% call 65 returned 100% call 66 never executed call 67 never executed call 68 never executed call 69 never executed call 70 never executed call 71 never executed call 72 never executed call 73 never executed call 74 never executed call 75 never executed call 76 never executed call 77 returned 100% call 78 returned 100% call 79 returned 100% call 80 returned 100% call 81 returned 100% call 82 returned 100% call 83 returned 100% call 84 returned 100% call 85 returned 100% call 86 returned 100% call 87 returned 100% call 88 returned 100% call 89 returned 100% call 90 returned 100% call 91 returned 100% call 92 returned 100% call 93 returned 100% call 94 returned 100% call 95 returned 100% call 96 returned 100% call 97 returned 100% call 98 returned 100% call 99 returned 100% call 100 returned 100% call 101 returned 100% call 102 returned 100% call 103 returned 100% call 104 returned 100% call 105 returned 100% call 106 returned 100% call 107 returned 100% call 108 returned 100% call 109 returned 100% call 110 returned 100% call 111 returned 100% call 112 returned 100% call 113 returned 100% call 114 returned 100% call 115 returned 100% call 116 returned 100% call 117 returned 100% call 118 returned 100% call 119 returned 100% call 120 returned 100% call 121 returned 100% call 122 returned 100% call 123 returned 100% call 124 returned 100% call 125 returned 100% call 126 returned 100% call 127 returned 100% call 128 returned 100% call 129 returned 100% call 130 returned 100% call 131 returned 100% call 132 returned 100% call 133 returned 100% call 134 returned 100% call 135 returned 100% call 136 returned 100% call 137 returned 100% call 138 returned 100% call 139 returned 100% call 140 returned 100% call 141 returned 100% call 142 returned 100% call 143 never executed call 144 never executed call 145 never executed call 146 never executed call 147 never executed call 148 never executed call 149 never executed call 150 never executed call 151 never executed call 152 never executed call 153 never executed call 154 returned 100% call 155 returned 100% call 156 returned 100% call 157 returned 100% call 158 returned 100% call 159 returned 100% call 160 returned 100% call 161 returned 100% call 162 returned 100% call 163 returned 100% call 164 returned 100% call 165 never executed call 166 never executed call 167 never executed call 168 never executed call 169 never executed call 170 never executed call 171 never executed call 172 never executed call 173 never executed call 174 never executed call 175 never executed call 176 never executed call 177 never executed call 178 never executed call 179 never executed call 180 never executed call 181 never executed call 182 never executed call 183 never executed call 184 never executed call 185 never executed call 186 never executed call 187 never executed call 188 never executed call 189 never executed call 190 never executed call 191 never executed call 192 never executed call 193 never executed call 194 never executed call 195 never executed call 196 never executed call 197 never executed call 198 never executed call 199 never executed call 200 never executed call 201 never executed call 202 never executed call 203 never executed call 204 never executed call 205 never executed call 206 never executed call 207 never executed call 208 never executed call 209 never executed call 210 never executed call 211 never executed call 212 never executed call 213 never executed call 214 never executed call 215 never executed call 216 never executed call 217 never executed call 218 never executed call 219 never executed call 220 never executed call 221 never executed call 222 never executed call 223 never executed call 224 never executed call 225 never executed call 226 never executed call 227 never executed call 228 never executed call 229 never executed call 230 never executed call 231 returned 100% call 232 returned 100% call 233 returned 100% call 234 returned 100% call 235 returned 100% call 236 returned 100% call 237 returned 100% call 238 returned 100% call 239 returned 100% call 240 returned 100% call 241 returned 100% call 242 never executed call 243 never executed call 244 never executed call 245 never executed call 246 never executed call 247 never executed call 248 never executed call 249 never executed call 250 never executed call 251 never executed call 252 never executed call 253 returned 100% call 254 returned 100% call 255 returned 100% call 256 returned 100% call 257 returned 100% call 258 returned 100% call 259 returned 100% call 260 returned 100% call 261 returned 100% call 262 returned 100% call 263 returned 100% call 264 returned 100% call 265 returned 100% call 266 returned 100% call 267 returned 100% call 268 returned 100% call 269 returned 100% call 270 returned 100% call 271 returned 100% call 272 returned 100% call 273 returned 100% call 274 returned 100% call 275 returned 100% call 276 returned 100% call 277 returned 100% call 278 returned 100% call 279 returned 100% call 280 returned 100% call 281 returned 100% call 282 returned 100% call 283 returned 100% call 284 returned 100% call 285 returned 100% call 286 never executed call 287 never executed call 288 never executed call 289 never executed call 290 never executed call 291 never executed call 292 never executed call 293 never executed call 294 never executed call 295 never executed call 296 never executed call 297 never executed call 298 never executed call 299 never executed call 300 never executed call 301 never executed call 302 never executed call 303 never executed call 304 never executed call 305 never executed call 306 never executed call 307 never executed call 308 never executed call 309 never executed call 310 never executed call 311 never executed call 312 never executed call 313 never executed call 314 never executed call 315 never executed call 316 never executed call 317 never executed call 318 never executed call 319 returned 100% call 320 returned 100% call 321 returned 100% call 322 returned 100% call 323 returned 100% call 324 returned 100% call 325 returned 100% call 326 returned 100% call 327 returned 100% call 328 returned 100% call 329 returned 100% call 330 returned 100% call 331 returned 100% call 332 returned 100% call 333 returned 100% call 334 returned 100% call 335 returned 100% call 336 returned 100% call 337 returned 100% call 338 returned 100% call 339 returned 100% call 340 returned 100% call 341 returned 100% call 342 returned 100% call 343 returned 100% call 344 returned 100% call 345 returned 100% call 346 returned 100% call 347 returned 100% call 348 returned 100% call 349 returned 100% call 350 returned 100% call 351 returned 100% call 352 never executed call 353 never executed call 354 never executed call 355 never executed call 356 never executed call 357 never executed call 358 never executed call 359 never executed call 360 never executed call 361 never executed call 362 never executed 204: 70: {} -: 71:private: function _ZNK5boost9unit_test17lazy_ostream_implIRKNS0_13basic_cstringIKcEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRA1_KcEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIdEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRA1_KcEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRA43_KcEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRA39_KcEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA10_cEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA8_cEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS0_13basic_cstringIKcEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRA1_KcEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRA44_KcEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRA42_KcEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIdEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIbEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tImEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIiEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIlEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS0_13basic_cstringIKcEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRA44_KcEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRA42_KcEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS0_13basic_cstringIKcEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRA1_KcEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA8_cEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA9_cEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA11_cEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA14_cEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA10_cEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIA7_cEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRA1_KcEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tIdEEEclERSo called 0 returned 0% blocks executed 0% function _ZNK5boost9unit_test17lazy_ostream_implIRKNS_10test_tools9tt_detail14print_helper_tINS2_19percent_tolerance_tIdEEEEEclERSo called 0 returned 0% blocks executed 0% #####: 72: virtual std::ostream& operator()( std::ostream& ostr ) const -: 73: { #####: 74: return m_prev(ostr) << m_value; call 0 never executed call 1 never executed call 2 never executed call 3 never executed call 4 never executed call 5 never executed call 6 never executed call 7 never executed call 8 never executed call 9 never executed call 10 never executed call 11 never executed call 12 never executed call 13 never executed call 14 never executed call 15 never executed call 16 never executed call 17 never executed call 18 never executed call 19 never executed call 20 never executed call 21 never executed call 22 never executed call 23 never executed call 24 never executed call 25 never executed call 26 never executed call 27 never executed call 28 never executed call 29 never executed call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed call 35 never executed call 36 never executed call 37 never executed call 38 never executed call 39 never executed call 40 never executed call 41 never executed call 42 never executed call 43 never executed call 44 never executed call 45 never executed call 46 never executed call 47 never executed call 48 never executed call 49 never executed call 50 never executed call 51 never executed call 52 never executed call 53 never executed call 54 never executed call 55 never executed call 56 never executed call 57 never executed call 58 never executed call 59 never executed call 60 never executed call 61 never executed call 62 never executed call 63 never executed call 64 never executed call 65 never executed call 66 never executed call 67 never executed call 68 never executed call 69 never executed call 70 never executed call 71 never executed call 72 never executed call 73 never executed call 74 never executed call 75 never executed call 76 never executed call 77 never executed call 78 never executed call 79 never executed call 80 never executed call 81 never executed call 82 never executed call 83 never executed call 84 never executed call 85 never executed call 86 never executed call 87 never executed call 88 never executed call 89 never executed call 90 never executed call 91 never executed call 92 never executed call 93 never executed call 94 never executed call 95 never executed call 96 never executed call 97 never executed call 98 never executed call 99 never executed call 100 never executed call 101 never executed call 102 never executed call 103 never executed call 104 never executed call 105 never executed call 106 never executed call 107 never executed call 108 never executed call 109 never executed call 110 never executed call 111 never executed call 112 never executed call 113 never executed call 114 never executed call 115 never executed call 116 never executed call 117 never executed call 118 never executed call 119 never executed call 120 never executed call 121 never executed call 122 never executed call 123 never executed call 124 never executed call 125 never executed call 126 never executed call 127 never executed call 128 never executed call 129 never executed call 130 never executed call 131 never executed call 132 never executed call 133 never executed call 134 never executed call 135 never executed call 136 never executed call 137 never executed call 138 never executed call 139 never executed call 140 never executed call 141 never executed call 142 never executed call 143 never executed call 144 never executed call 145 never executed call 146 never executed call 147 never executed call 148 never executed call 149 never executed call 150 never executed call 151 never executed call 152 never executed call 153 never executed call 154 never executed call 155 never executed call 156 never executed call 157 never executed call 158 never executed call 159 never executed call 160 never executed call 161 never executed call 162 never executed call 163 never executed call 164 never executed call 165 never executed call 166 never executed call 167 never executed call 168 never executed call 169 never executed call 170 never executed call 171 never executed call 172 never executed call 173 never executed call 174 never executed call 175 never executed call 176 never executed call 177 never executed call 178 never executed call 179 never executed call 180 never executed call 181 never executed call 182 never executed call 183 never executed call 184 never executed call 185 never executed call 186 never executed call 187 never executed call 188 never executed call 189 never executed call 190 never executed call 191 never executed call 192 never executed call 193 never executed call 194 never executed call 195 never executed call 196 never executed call 197 never executed call 198 never executed call 199 never executed call 200 never executed call 201 never executed call 202 never executed call 203 never executed call 204 never executed call 205 never executed call 206 never executed call 207 never executed call 208 never executed call 209 never executed call 210 never executed call 211 never executed call 212 never executed call 213 never executed call 214 never executed call 215 never executed call 216 never executed call 217 never executed call 218 never executed call 219 never executed call 220 never executed call 221 never executed call 222 never executed call 223 never executed call 224 never executed call 225 never executed call 226 never executed call 227 never executed call 228 never executed call 229 never executed call 230 never executed call 231 never executed call 232 never executed call 233 never executed call 234 never executed call 235 never executed call 236 never executed call 237 never executed call 238 never executed call 239 never executed call 240 never executed call 241 never executed call 242 never executed call 243 never executed call 244 never executed call 245 never executed call 246 never executed call 247 never executed call 248 never executed call 249 never executed call 250 never executed call 251 never executed call 252 never executed call 253 never executed call 254 never executed call 255 never executed call 256 never executed call 257 never executed call 258 never executed call 259 never executed call 260 never executed call 261 never executed call 262 never executed call 263 never executed call 264 never executed call 265 never executed call 266 never executed call 267 never executed call 268 never executed call 269 never executed call 270 never executed call 271 never executed call 272 never executed call 273 never executed call 274 never executed call 275 never executed call 276 never executed call 277 never executed call 278 never executed call 279 never executed call 280 never executed call 281 never executed call 282 never executed call 283 never executed call 284 never executed call 285 never executed call 286 never executed call 287 never executed call 288 never executed call 289 never executed call 290 never executed call 291 never executed call 292 never executed call 293 never executed call 294 never executed call 295 never executed call 296 never executed call 297 never executed call 298 never executed call 299 never executed call 300 never executed call 301 never executed call 302 never executed call 303 never executed call 304 never executed call 305 never executed call 306 never executed call 307 never executed call 308 never executed call 309 never executed call 310 never executed call 311 never executed call 312 never executed call 313 never executed call 314 never executed call 315 never executed call 316 never executed call 317 never executed call 318 never executed call 319 never executed call 320 never executed call 321 never executed call 322 never executed call 323 never executed call 324 never executed call 325 never executed call 326 never executed call 327 never executed call 328 never executed call 329 never executed call 330 never executed call 331 never executed call 332 never executed call 333 never executed call 334 never executed call 335 never executed call 336 never executed call 337 never executed call 338 never executed call 339 never executed call 340 never executed call 341 never executed call 342 never executed call 343 never executed call 344 never executed call 345 never executed call 346 never executed call 347 never executed call 348 never executed call 349 never executed call 350 never executed call 351 never executed call 352 never executed call 353 never executed call 354 never executed call 355 never executed call 356 never executed call 357 never executed call 358 never executed call 359 never executed call 360 never executed call 361 never executed call 362 never executed call 363 never executed call 364 never executed call 365 never executed call 366 never executed call 367 never executed call 368 never executed call 369 never executed call 370 never executed call 371 never executed call 372 never executed call 373 never executed call 374 never executed call 375 never executed call 376 never executed call 377 never executed call 378 never executed call 379 never executed call 380 never executed call 381 never executed call 382 never executed call 383 never executed call 384 never executed call 385 never executed call 386 never executed call 387 never executed call 388 never executed call 389 never executed call 390 never executed call 391 never executed call 392 never executed call 393 never executed call 394 never executed call 395 never executed call 396 never executed call 397 never executed call 398 never executed call 399 never executed call 400 never executed call 401 never executed call 402 never executed call 403 never executed call 404 never executed call 405 never executed call 406 never executed call 407 never executed call 408 never executed call 409 never executed call 410 never executed call 411 never executed call 412 never executed call 413 never executed call 414 never executed call 415 never executed call 416 never executed call 417 never executed call 418 never executed call 419 never executed call 420 never executed call 421 never executed call 422 never executed call 423 never executed call 424 never executed call 425 never executed call 426 never executed call 427 never executed call 428 never executed call 429 never executed call 430 never executed call 431 never executed call 432 never executed call 433 never executed call 434 never executed call 435 never executed call 436 never executed call 437 never executed call 438 never executed call 439 never executed call 440 never executed call 441 never executed call 442 never executed call 443 never executed call 444 never executed call 445 never executed call 446 never executed call 447 never executed call 448 never executed call 449 never executed call 450 never executed call 451 never executed call 452 never executed call 453 never executed call 454 never executed call 455 never executed call 456 never executed call 457 never executed call 458 never executed call 459 never executed call 460 never executed call 461 never executed call 462 never executed call 463 never executed call 464 never executed call 465 never executed call 466 never executed call 467 never executed call 468 never executed call 469 never executed call 470 never executed call 471 never executed call 472 never executed call 473 never executed call 474 never executed call 475 never executed call 476 never executed call 477 never executed call 478 never executed call 479 never executed call 480 never executed call 481 never executed call 482 never executed call 483 never executed call 484 never executed call 485 never executed call 486 never executed call 487 never executed call 488 never executed call 489 never executed call 490 never executed call 491 never executed call 492 never executed call 493 never executed call 494 never executed call 495 never executed call 496 never executed call 497 never executed call 498 never executed call 499 never executed call 500 never executed call 501 never executed call 502 never executed call 503 never executed call 504 never executed call 505 never executed call 506 never executed call 507 never executed call 508 never executed call 509 never executed call 510 never executed call 511 never executed call 512 never executed call 513 never executed call 514 never executed call 515 never executed call 516 never executed call 517 never executed call 518 never executed call 519 never executed call 520 never executed call 521 never executed call 522 never executed call 523 never executed call 524 never executed call 525 never executed call 526 never executed call 527 never executed call 528 never executed call 529 never executed call 530 never executed call 531 never executed call 532 never executed call 533 never executed call 534 never executed call 535 never executed call 536 never executed call 537 never executed call 538 never executed call 539 never executed call 540 never executed call 541 never executed call 542 never executed call 543 never executed call 544 never executed call 545 never executed call 546 never executed call 547 never executed call 548 never executed call 549 never executed call 550 never executed call 551 never executed call 552 never executed call 553 never executed call 554 never executed call 555 never executed call 556 never executed call 557 never executed call 558 never executed call 559 never executed call 560 never executed call 561 never executed call 562 never executed call 563 never executed call 564 never executed call 565 never executed call 566 never executed call 567 never executed call 568 never executed call 569 never executed call 570 never executed call 571 never executed call 572 never executed call 573 never executed call 574 never executed call 575 never executed call 576 never executed call 577 never executed call 578 never executed call 579 never executed call 580 never executed call 581 never executed call 582 never executed call 583 never executed call 584 never executed call 585 never executed call 586 never executed call 587 never executed call 588 never executed call 589 never executed call 590 never executed call 591 never executed call 592 never executed call 593 never executed call 594 never executed call 595 never executed call 596 never executed call 597 never executed call 598 never executed call 599 never executed call 600 never executed call 601 never executed call 602 never executed call 603 never executed call 604 never executed call 605 never executed call 606 never executed call 607 never executed call 608 never executed call 609 never executed call 610 never executed call 611 never executed call 612 never executed call 613 never executed call 614 never executed call 615 never executed call 616 never executed call 617 never executed call 618 never executed call 619 never executed call 620 never executed call 621 never executed call 622 never executed call 623 never executed call 624 never executed call 625 never executed call 626 never executed call 627 never executed call 628 never executed call 629 never executed call 630 never executed call 631 never executed call 632 never executed call 633 never executed call 634 never executed call 635 never executed call 636 never executed call 637 never executed call 638 never executed call 639 never executed call 640 never executed call 641 never executed call 642 never executed call 643 never executed call 644 never executed call 645 never executed call 646 never executed call 647 never executed call 648 never executed call 649 never executed call 650 never executed call 651 never executed call 652 never executed call 653 never executed call 654 never executed call 655 never executed call 656 never executed call 657 never executed call 658 never executed call 659 never executed call 660 never executed call 661 never executed call 662 never executed call 663 never executed call 664 never executed call 665 never executed call 666 never executed call 667 never executed call 668 never executed call 669 never executed call 670 never executed call 671 never executed call 672 never executed call 673 never executed call 674 never executed call 675 never executed call 676 never executed call 677 never executed call 678 never executed call 679 never executed call 680 never executed call 681 never executed call 682 never executed call 683 never executed call 684 never executed call 685 never executed call 686 never executed call 687 never executed call 688 never executed call 689 never executed call 690 never executed call 691 never executed call 692 never executed call 693 never executed call 694 never executed call 695 never executed call 696 never executed call 697 never executed call 698 never executed call 699 never executed call 700 never executed call 701 never executed call 702 never executed call 703 never executed call 704 never executed call 705 never executed call 706 never executed call 707 never executed call 708 never executed call 709 never executed call 710 never executed call 711 never executed call 712 never executed call 713 never executed call 714 never executed call 715 never executed call 716 never executed call 717 never executed call 718 never executed call 719 never executed call 720 never executed call 721 never executed call 722 never executed call 723 never executed call 724 never executed call 725 never executed call 726 never executed call 727 never executed call 728 never executed call 729 never executed call 730 never executed call 731 never executed call 732 never executed call 733 never executed call 734 never executed call 735 never executed call 736 never executed call 737 never executed call 738 never executed call 739 never executed call 740 never executed call 741 never executed call 742 never executed call 743 never executed call 744 never executed call 745 never executed call 746 never executed call 747 never executed -: 75: } -: 76: -: 77: // Data members -: 78: lazy_ostream const& m_prev; -: 79: T m_value; -: 80:}; -: 81: -: 82://____________________________________________________________________________// -: 83: -: 84:template -: 85:inline lazy_ostream_impl function _ZN5boost9unit_testlsINS_10test_tools9tt_detail14print_helper_tIdEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES9_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_testlsIA1_cEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES6_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_testlsINS0_13basic_cstringIKcEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES8_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_testlsINS_10test_tools9tt_detail14print_helper_tIA8_cEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamESA_ called 6 returned 100% blocks executed 100% function _ZN5boost9unit_testlsINS_10test_tools9tt_detail14print_helper_tIA10_cEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamESA_ called 4 returned 100% blocks executed 100% function _ZN5boost9unit_testlsINS_10test_tools9tt_detail14print_helper_tINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamESF_ called 23 returned 100% blocks executed 100% function _ZN5boost9unit_testlsIA39_cEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES6_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_testlsIA43_cEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES6_ called 1 returned 100% blocks executed 100% function _ZN5boost9unit_testlsIA1_cEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES6_ called 54 returned 100% blocks executed 100% function _ZN5boost9unit_testlsINS_10test_tools9tt_detail14print_helper_tIlEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES9_ called 2 returned 100% blocks executed 100% function _ZN5boost9unit_testlsINS_10test_tools9tt_detail14print_helper_tIiEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES9_ called 3 returned 100% blocks executed 100% function _ZN5boost9unit_testlsINS_10test_tools9tt_detail14print_helper_tImEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES9_ called 1 returned 100% blocks executed 100% function _ZN5boost9unit_testlsINS_10test_tools9tt_detail14print_helper_tIbEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES9_ called 8 returned 100% blocks executed 100% function _ZN5boost9unit_testlsINS_10test_tools9tt_detail14print_helper_tIdEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES9_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_testlsIA42_cEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES6_ called 7 returned 100% blocks executed 100% function _ZN5boost9unit_testlsIA44_cEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES6_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_testlsIA1_cEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES6_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_testlsINS0_13basic_cstringIKcEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES8_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_testlsIA42_cEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES6_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_testlsIA44_cEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES6_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_testlsINS0_13basic_cstringIKcEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES8_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_testlsINS_10test_tools9tt_detail14print_helper_tIA7_cEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamESA_ called 3 returned 100% blocks executed 100% function _ZN5boost9unit_testlsINS_10test_tools9tt_detail14print_helper_tIA10_cEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamESA_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_testlsINS_10test_tools9tt_detail14print_helper_tIA14_cEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamESA_ called 3 returned 100% blocks executed 100% function _ZN5boost9unit_testlsINS_10test_tools9tt_detail14print_helper_tIA11_cEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamESA_ called 4 returned 100% blocks executed 100% function _ZN5boost9unit_testlsINS_10test_tools9tt_detail14print_helper_tIA9_cEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamESA_ called 3 returned 100% blocks executed 100% function _ZN5boost9unit_testlsINS_10test_tools9tt_detail14print_helper_tIA8_cEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamESA_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_testlsINS_10test_tools9tt_detail14print_helper_tINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamESF_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_testlsIA1_cEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES6_ called 0 returned 0% blocks executed 0% function _ZN5boost9unit_testlsINS0_13basic_cstringIKcEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES8_ called 32 returned 100% blocks executed 100% function _ZN5boost9unit_testlsINS_10test_tools9tt_detail14print_helper_tINS2_19percent_tolerance_tIdEEEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamESB_ called 2 returned 100% blocks executed 100% function _ZN5boost9unit_testlsINS_10test_tools9tt_detail14print_helper_tIdEEEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES9_ called 48 returned 100% blocks executed 100% function _ZN5boost9unit_testlsIA1_cEENS0_17lazy_ostream_implIRKT_EERKNS0_12lazy_ostreamES6_ called 0 returned 0% blocks executed 0% 204: 86:operator<<( lazy_ostream const& prev, T const& v ) -: 87:{ 204: 88: return lazy_ostream_impl( prev, v ); call 0 never executed call 1 never executed call 2 never executed call 3 never executed call 4 never executed call 5 never executed call 6 never executed call 7 never executed call 8 never executed call 9 returned 100% call 10 returned 100% call 11 returned 100% call 12 returned 100% call 13 returned 100% call 14 returned 100% call 15 returned 100% call 16 returned 100% call 17 returned 100% call 18 never executed call 19 never executed call 20 never executed call 21 returned 100% call 22 returned 100% call 23 returned 100% call 24 returned 100% call 25 returned 100% call 26 returned 100% call 27 returned 100% call 28 returned 100% call 29 returned 100% call 30 returned 100% call 31 returned 100% call 32 returned 100% call 33 returned 100% call 34 returned 100% call 35 returned 100% call 36 returned 100% call 37 returned 100% call 38 returned 100% call 39 never executed call 40 never executed call 41 never executed call 42 returned 100% call 43 returned 100% call 44 returned 100% call 45 never executed call 46 never executed call 47 never executed call 48 never executed call 49 never executed call 50 never executed call 51 never executed call 52 never executed call 53 never executed call 54 never executed call 55 never executed call 56 never executed call 57 never executed call 58 never executed call 59 never executed call 60 never executed call 61 never executed call 62 never executed call 63 returned 100% call 64 returned 100% call 65 returned 100% call 66 never executed call 67 never executed call 68 never executed call 69 returned 100% call 70 returned 100% call 71 returned 100% call 72 returned 100% call 73 returned 100% call 74 returned 100% call 75 returned 100% call 76 returned 100% call 77 returned 100% call 78 never executed call 79 never executed call 80 never executed call 81 never executed call 82 never executed call 83 never executed call 84 never executed call 85 never executed call 86 never executed call 87 returned 100% call 88 returned 100% call 89 returned 100% call 90 returned 100% call 91 returned 100% call 92 returned 100% call 93 returned 100% call 94 returned 100% call 95 returned 100% call 96 never executed call 97 never executed call 98 never executed -: 89:} -: 90: -: 91://____________________________________________________________________________// -: 92: -: 93:#if BOOST_TEST_USE_STD_LOCALE -: 94: -: 95:template -: 96:inline lazy_ostream_impl -: 97:operator<<( lazy_ostream const& prev, R& (BOOST_TEST_CALL_DECL *man)(S&) ) -: 98:{ -: 99: return lazy_ostream_impl( prev, man ); -: 100:} -: 101: -: 102://____________________________________________________________________________// -: 103: -: 104:#endif -: 105: -: 106:} // namespace unit_test -: 107: -: 108:} // namespace boost -: 109: -: 110://____________________________________________________________________________// -: 111: -: 112:#include -: 113: -: 114:#endif // BOOST_TEST_LAZY_OSTREAM_HPP_070708GER <<<<<< EOF # path=/home/travis/build/richelbilderbeek/AminoAcidFighter/#usr#include#boost#smart_ptr#shared_ptr.hpp.gcov -: 0:Source:/usr/include/boost/smart_ptr/shared_ptr.hpp -: 0:Programs:19 -: 1:#ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED -: 2:#define BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED -: 3: -: 4:// -: 5:// shared_ptr.hpp -: 6:// -: 7:// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -: 8:// Copyright (c) 2001-2008 Peter Dimov -: 9:// -: 10:// Distributed under the Boost Software License, Version 1.0. (See -: 11:// accompanying file LICENSE_1_0.txt or copy at -: 12:// http://www.boost.org/LICENSE_1_0.txt) -: 13:// -: 14:// See http://www.boost.org/libs/smart_ptr/shared_ptr.htm for documentation. -: 15:// -: 16: -: 17:#include // for broken compiler workarounds -: 18: -: 19:// In order to avoid circular dependencies with Boost.TR1 -: 20:// we make sure that our include of doesn't try to -: 21:// pull in the TR1 headers: that's why we use this header -: 22:// rather than including directly: -: 23:#include // std::auto_ptr -: 24: -: 25:#include -: 26:#include -: 27:#include -: 28:#include -: 29:#include -: 30:#include -: 31:#include -: 32: -: 33:#if !defined(BOOST_SP_NO_ATOMIC_ACCESS) -: 34:#include -: 35:#endif -: 36: -: 37:#include // for std::swap -: 38:#include // for std::less -: 39:#include // for std::bad_cast -: 40:#include // for std::size_t -: 41: -: 42:#if !defined(BOOST_NO_IOSTREAM) -: 43:#if !defined(BOOST_NO_IOSFWD) -: 44:#include // for std::basic_ostream -: 45:#else -: 46:#include -: 47:#endif -: 48:#endif -: 49: -: 50:namespace boost -: 51:{ -: 52: -: 53:template class shared_ptr; -: 54:template class weak_ptr; -: 55:template class enable_shared_from_this; -: 56:class enable_shared_from_raw; -: 57: -: 58:namespace detail -: 59:{ -: 60: -: 61:// sp_element, element_type -: 62: -: 63:template< class T > struct sp_element -: 64:{ -: 65: typedef T type; -: 66:}; -: 67: -: 68:#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) -: 69: -: 70:template< class T > struct sp_element< T[] > -: 71:{ -: 72: typedef T type; -: 73:}; -: 74: -: 75:#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) -: 76: -: 77:template< class T, std::size_t N > struct sp_element< T[N] > -: 78:{ -: 79: typedef T type; -: 80:}; -: 81: -: 82:#endif -: 83: -: 84:#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) -: 85: -: 86:// sp_dereference, return type of operator* -: 87: -: 88:template< class T > struct sp_dereference -: 89:{ -: 90: typedef T & type; -: 91:}; -: 92: -: 93:template<> struct sp_dereference< void > -: 94:{ -: 95: typedef void type; -: 96:}; -: 97: -: 98:#if !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) -: 99: -: 100:template<> struct sp_dereference< void const > -: 101:{ -: 102: typedef void type; -: 103:}; -: 104: -: 105:template<> struct sp_dereference< void volatile > -: 106:{ -: 107: typedef void type; -: 108:}; -: 109: -: 110:template<> struct sp_dereference< void const volatile > -: 111:{ -: 112: typedef void type; -: 113:}; -: 114: -: 115:#endif // !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) -: 116: -: 117:#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) -: 118: -: 119:template< class T > struct sp_dereference< T[] > -: 120:{ -: 121: typedef void type; -: 122:}; -: 123: -: 124:#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) -: 125: -: 126:template< class T, std::size_t N > struct sp_dereference< T[N] > -: 127:{ -: 128: typedef void type; -: 129:}; -: 130: -: 131:#endif -: 132: -: 133:#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) -: 134: -: 135:// sp_member_access, return type of operator-> -: 136: -: 137:template< class T > struct sp_member_access -: 138:{ -: 139: typedef T * type; -: 140:}; -: 141: -: 142:#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) -: 143: -: 144:template< class T > struct sp_member_access< T[] > -: 145:{ -: 146: typedef void type; -: 147:}; -: 148: -: 149:#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) -: 150: -: 151:template< class T, std::size_t N > struct sp_member_access< T[N] > -: 152:{ -: 153: typedef void type; -: 154:}; -: 155: -: 156:#endif -: 157: -: 158:#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) -: 159: -: 160:// sp_array_access, return type of operator[] -: 161: -: 162:template< class T > struct sp_array_access -: 163:{ -: 164: typedef void type; -: 165:}; -: 166: -: 167:#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) -: 168: -: 169:template< class T > struct sp_array_access< T[] > -: 170:{ -: 171: typedef T & type; -: 172:}; -: 173: -: 174:#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) -: 175: -: 176:template< class T, std::size_t N > struct sp_array_access< T[N] > -: 177:{ -: 178: typedef T & type; -: 179:}; -: 180: -: 181:#endif -: 182: -: 183:#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) -: 184: -: 185:// sp_extent, for operator[] index check -: 186: -: 187:template< class T > struct sp_extent -: 188:{ -: 189: enum _vt { value = 0 }; -: 190:}; -: 191: -: 192:#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) -: 193: -: 194:template< class T, std::size_t N > struct sp_extent< T[N] > -: 195:{ -: 196: enum _vt { value = N }; -: 197:}; -: 198: -: 199:#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) -: 200: -: 201:// enable_shared_from_this support -: 202: -: 203:template< class X, class Y, class T > inline void sp_enable_shared_from_this( boost::shared_ptr const * ppx, Y const * py, boost::enable_shared_from_this< T > const * pe ) -: 204:{ -: 205: if( pe != 0 ) -: 206: { -: 207: pe->_internal_accept_owner( ppx, const_cast< Y* >( py ) ); -: 208: } -: 209:} -: 210: -: 211:template< class X, class Y > inline void sp_enable_shared_from_this( boost::shared_ptr * ppx, Y const * py, boost::enable_shared_from_raw const * pe ); -: 212: -: 213:#ifdef _MANAGED -: 214: -: 215:// Avoid C4793, ... causes native code generation -: 216: -: 217:struct sp_any_pointer -: 218:{ -: 219: template sp_any_pointer( T* ) {} -: 220:}; -: 221: -: 222:inline void sp_enable_shared_from_this( sp_any_pointer, sp_any_pointer, sp_any_pointer ) -: 223:{ -: 224:} -: 225: -: 226:#else // _MANAGED -: 227: function _ZN5boost6detail26sp_enable_shared_from_thisEz called 0 returned 0% blocks executed 0% function _ZN5boost6detail26sp_enable_shared_from_thisEz called 42 returned 100% blocks executed 100% function _ZN5boost6detail26sp_enable_shared_from_thisEz called 0 returned 0% blocks executed 0% function _ZN5boost6detail26sp_enable_shared_from_thisEz called 0 returned 0% blocks executed 0% function _ZN5boost6detail26sp_enable_shared_from_thisEz called 0 returned 0% blocks executed 0% function _ZN5boost6detail26sp_enable_shared_from_thisEz called 0 returned 0% blocks executed 0% function _ZN5boost6detail26sp_enable_shared_from_thisEz called 0 returned 0% blocks executed 0% 42: 228:inline void sp_enable_shared_from_this( ... ) -: 229:{ 42: 230:} -: 231: -: 232:#endif // _MANAGED -: 233: -: 234:#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( BOOST_NO_AUTO_PTR ) -: 235: -: 236:// rvalue auto_ptr support based on a technique by Dave Abrahams -: 237: -: 238:template< class T, class R > struct sp_enable_if_auto_ptr -: 239:{ -: 240:}; -: 241: -: 242:template< class T, class R > struct sp_enable_if_auto_ptr< std::auto_ptr< T >, R > -: 243:{ -: 244: typedef R type; -: 245:}; -: 246: -: 247:#endif -: 248: -: 249:// sp_assert_convertible -: 250: -: 251:template< class Y, class T > inline void sp_assert_convertible() -: 252:{ -: 253:#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) -: 254: -: 255: // static_assert( sp_convertible< Y, T >::value ); -: 256: typedef char tmp[ sp_convertible< Y, T >::value? 1: -1 ]; -: 257: (void)sizeof( tmp ); -: 258: -: 259:#else -: 260: -: 261: T* p = static_cast< Y* >( 0 ); -: 262: (void)p; -: 263: -: 264:#endif -: 265:} -: 266: -: 267:// pointer constructor helper -: 268: function _ZN5boost6detail20sp_pointer_constructINS_9unit_test9ut_detail14callback0_implINS3_6unusedEEENS3_16callback0_impl_tIS5_PFvvEEEEEvPNS_10shared_ptrIT_EEPT0_RNS0_12shared_countE called 0 returned 0% blocks executed 0% function _ZN5boost6detail20sp_pointer_constructINS_9unit_test9ut_detail14callback0_implINS3_6unusedEEENS3_16callback0_impl_tIS5_PFvvEEEEEvPNS_10shared_ptrIT_EEPT0_RNS0_12shared_countE called 42 returned 100% blocks executed 100% function _ZN5boost6detail20sp_pointer_constructINS_9unit_test9ut_detail14callback0_implINS3_6unusedEEENS3_16callback0_impl_tIS5_PFvvEEEEEvPNS_10shared_ptrIT_EEPT0_RNS0_12shared_countE called 0 returned 0% blocks executed 0% function _ZN5boost6detail20sp_pointer_constructINS_9unit_test9ut_detail14callback0_implINS3_6unusedEEENS3_16callback0_impl_tIS5_PFvvEEEEEvPNS_10shared_ptrIT_EEPT0_RNS0_12shared_countE called 0 returned 0% blocks executed 0% function _ZN5boost6detail20sp_pointer_constructINS_9unit_test9ut_detail14callback0_implINS3_6unusedEEENS3_16callback0_impl_tIS5_PFvvEEEEEvPNS_10shared_ptrIT_EEPT0_RNS0_12shared_countE called 0 returned 0% blocks executed 0% function _ZN5boost6detail20sp_pointer_constructINS_9unit_test9ut_detail14callback0_implINS3_6unusedEEENS3_16callback0_impl_tIS5_PFvvEEEEEvPNS_10shared_ptrIT_EEPT0_RNS0_12shared_countE called 0 returned 0% blocks executed 0% function _ZN5boost6detail20sp_pointer_constructINS_9unit_test9ut_detail14callback0_implINS3_6unusedEEENS3_16callback0_impl_tIS5_PFvvEEEEEvPNS_10shared_ptrIT_EEPT0_RNS0_12shared_countE called 0 returned 0% blocks executed 0% function _ZN5boost6detail20sp_pointer_constructINS_23basic_wrap_stringstreamIcEES3_EEvPNS_10shared_ptrIT_EEPT0_RNS0_12shared_countE called 0 returned 0% blocks executed 0% 42: 269:template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T > * ppx, Y * p, boost::detail::shared_count & pn ) -: 270:{ 42: 271: boost::detail::shared_count( p ).swap( pn ); call 0 never executed call 1 never executed call 2 never executed call 3 never executed call 4 never executed call 5 returned 100% call 6 returned 100% call 7 returned 100% call 8 returned 100% call 9 returned 100% call 10 never executed call 11 never executed call 12 never executed call 13 never executed call 14 never executed call 15 never executed call 16 never executed call 17 never executed call 18 never executed call 19 never executed call 20 never executed call 21 never executed call 22 never executed call 23 never executed call 24 never executed call 25 never executed call 26 never executed call 27 never executed call 28 never executed call 29 never executed call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed call 35 never executed call 36 never executed call 37 never executed call 38 never executed call 39 never executed 42: 272: boost::detail::sp_enable_shared_from_this( ppx, p, p ); call 0 never executed call 1 returned 100% call 2 never executed call 3 never executed call 4 never executed call 5 never executed call 6 never executed call 7 never executed 42: 273:} -: 274: -: 275:#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) -: 276: -: 277:template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * p, boost::detail::shared_count & pn ) -: 278:{ -: 279: sp_assert_convertible< Y[], T[] >(); -: 280: boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn ); -: 281:} -: 282: -: 283:template< class T, std::size_t N, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[N] > * /*ppx*/, Y * p, boost::detail::shared_count & pn ) -: 284:{ -: 285: sp_assert_convertible< Y[N], T[N] >(); -: 286: boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn ); -: 287:} -: 288: -: 289:#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) -: 290: -: 291:// deleter constructor helper -: 292: -: 293:template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T > * ppx, Y * p ) -: 294:{ -: 295: boost::detail::sp_enable_shared_from_this( ppx, p, p ); -: 296:} -: 297: -: 298:#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) -: 299: -: 300:template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * /*p*/ ) -: 301:{ -: 302: sp_assert_convertible< Y[], T[] >(); -: 303:} -: 304: -: 305:template< class T, std::size_t N, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[N] > * /*ppx*/, Y * /*p*/ ) -: 306:{ -: 307: sp_assert_convertible< Y[N], T[N] >(); -: 308:} -: 309: -: 310:#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) -: 311: -: 312:} // namespace detail -: 313: -: 314: -: 315:// -: 316:// shared_ptr -: 317:// -: 318:// An enhanced relative of scoped_ptr with reference counted copy semantics. -: 319:// The object pointed to is deleted when the last shared_ptr pointing to it -: 320:// is destroyed or reset. -: 321:// -: 322: function _ZN5boost10shared_ptrINS_9unit_test9ut_detail14callback0_implINS2_6unusedEEEED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_23basic_wrap_stringstreamIcEEED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_9unit_test9ut_detail14callback0_implINS2_6unusedEEEED2Ev called 42 returned 100% blocks executed 100% function _ZN5boost10shared_ptrINS_23basic_wrap_stringstreamIcEEED2Ev called 100 returned 100% blocks executed 100% function _ZN5boost10shared_ptrINS_9unit_test9ut_detail14callback0_implINS2_6unusedEEEED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_23basic_wrap_stringstreamIcEEED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_9unit_test9ut_detail14callback0_implINS2_6unusedEEEED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_23basic_wrap_stringstreamIcEEED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_9unit_test9ut_detail14callback0_implINS2_6unusedEEEED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_9unit_test9ut_detail14callback0_implINS2_6unusedEEEED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_23basic_wrap_stringstreamIcEEED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_9unit_test9ut_detail14callback0_implINS2_6unusedEEEED2Ev called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_23basic_wrap_stringstreamIcEEED2Ev called 0 returned 0% blocks executed 0% 142: 323:template class shared_ptr call 0 never executed call 1 never executed call 2 never executed call 3 never executed call 4 never executed call 5 never executed call 6 returned 100% call 7 returned 100% call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% call 12 never executed call 13 never executed call 14 never executed call 15 never executed call 16 never executed call 17 never executed call 18 never executed call 19 never executed call 20 never executed call 21 never executed call 22 never executed call 23 never executed call 24 never executed call 25 never executed call 26 never executed call 27 never executed call 28 never executed call 29 never executed call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed call 35 never executed call 36 never executed call 37 never executed call 38 never executed -: 324:{ -: 325:private: -: 326: -: 327: // Borland 5.5.1 specific workaround -: 328: typedef shared_ptr this_type; -: 329: -: 330:public: -: 331: -: 332: typedef typename boost::detail::sp_element< T >::type element_type; -: 333: function _ZN5boost10shared_ptrINS_23basic_wrap_stringstreamIcEEEC2Ev called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_23basic_wrap_stringstreamIcEEEC2Ev called 100 returned 100% blocks executed 100% function _ZN5boost10shared_ptrINS_23basic_wrap_stringstreamIcEEEC2Ev called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_23basic_wrap_stringstreamIcEEEC2Ev called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_23basic_wrap_stringstreamIcEEEC2Ev called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_23basic_wrap_stringstreamIcEEEC2Ev called 0 returned 0% blocks executed 0% 100: 334: shared_ptr() BOOST_NOEXCEPT : px( 0 ), pn() // never throws in 1.30+ call 0 never executed call 1 never executed call 2 returned 100% call 3 returned 100% call 4 never executed call 5 never executed call 6 never executed call 7 never executed call 8 never executed call 9 never executed call 10 never executed call 11 never executed -: 335: { 100: 336: } -: 337: -: 338:#if !defined( BOOST_NO_CXX11_NULLPTR ) -: 339: -: 340: shared_ptr( boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT : px( 0 ), pn() // never throws -: 341: { -: 342: } -: 343: -: 344:#endif -: 345: -: 346: template function _ZN5boost10shared_ptrINS_9unit_test9ut_detail14callback0_implINS2_6unusedEEEEC2INS2_16callback0_impl_tIS4_PFvvEEEEEPT_ called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_9unit_test9ut_detail14callback0_implINS2_6unusedEEEEC2INS2_16callback0_impl_tIS4_PFvvEEEEEPT_ called 42 returned 100% blocks executed 75% function _ZN5boost10shared_ptrINS_9unit_test9ut_detail14callback0_implINS2_6unusedEEEEC2INS2_16callback0_impl_tIS4_PFvvEEEEEPT_ called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_9unit_test9ut_detail14callback0_implINS2_6unusedEEEEC2INS2_16callback0_impl_tIS4_PFvvEEEEEPT_ called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_9unit_test9ut_detail14callback0_implINS2_6unusedEEEEC2INS2_16callback0_impl_tIS4_PFvvEEEEEPT_ called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_9unit_test9ut_detail14callback0_implINS2_6unusedEEEEC2INS2_16callback0_impl_tIS4_PFvvEEEEEPT_ called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_9unit_test9ut_detail14callback0_implINS2_6unusedEEEEC2INS2_16callback0_impl_tIS4_PFvvEEEEEPT_ called 0 returned 0% blocks executed 0% function _ZN5boost10shared_ptrINS_23basic_wrap_stringstreamIcEEEC2IS2_EEPT_ called 0 returned 0% blocks executed 0% 42: 347: explicit shared_ptr( Y * p ): px( p ), pn() // Y must be complete call 0 never executed call 1 never executed call 2 never executed call 3 never executed call 4 returned 100% call 5 returned 100% call 6 never executed call 7 never executed call 8 never executed call 9 never executed call 10 never executed call 11 never executed call 12 never executed call 13 never executed call 14 never executed call 15 never executed call 16 never executed call 17 never executed call 18 never executed call 19 never executed call 20 never executed call 21 never executed call 22 never executed call 23 never executed call 24 never executed call 25 never executed call 26 never executed call 27 never executed call 28 never executed call 29 never executed call 30 never executed call 31 never executed -: 348: { 42: 349: boost::detail::sp_pointer_construct( this, p, pn ); call 0 never executed call 1 never executed branch 2 never executed branch 3 never executed call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 never executed call 9 never executed branch 10 never executed branch 11 never executed call 12 never executed call 13 never executed branch 14 never executed branch 15 never executed call 16 never executed call 17 never executed branch 18 never executed branch 19 never executed call 20 never executed call 21 never executed branch 22 never executed branch 23 never executed call 24 never executed call 25 never executed branch 26 never executed branch 27 never executed call 28 never executed call 29 never executed branch 30 never executed branch 31 never executed 42: 350: } -: 351: -: 352: // -: 353: // Requirements: D's copy constructor must not throw -: 354: // -: 355: // shared_ptr will release p by calling d(p) -: 356: // -: 357: -: 358: template shared_ptr( Y * p, D d ): px( p ), pn( p, d ) -: 359: { -: 360: boost::detail::sp_deleter_construct( this, p ); -: 361: } -: 362: -: 363:#if !defined( BOOST_NO_CXX11_NULLPTR ) -: 364: -: 365: template shared_ptr( boost::detail::sp_nullptr_t p, D d ): px( p ), pn( p, d ) -: 366: { -: 367: } -: 368: -: 369:#endif -: 370: -: 371: // As above, but with allocator. A's copy constructor shall not throw. -: 372: -: 373: template shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a ) -: 374: { -: 375: boost::detail::sp_deleter_construct( this, p ); -: 376: } -: 377: -: 378:#if !defined( BOOST_NO_CXX11_NULLPTR ) -: 379: -: 380: template shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, d, a ) -: 381: { -: 382: } -: 383: -: 384:#endif -: 385: -: 386:// generated copy constructor, destructor are fine... -: 387: -: 388:#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) -: 389: -: 390:// ... except in C++0x, move disables the implicit copy -: 391: -: 392: shared_ptr( shared_ptr const & r ) BOOST_NOEXCEPT : px( r.px ), pn( r.pn ) -: 393: { -: 394: } -: 395: -: 396:#endif -: 397: -: 398: template -: 399: explicit shared_ptr( weak_ptr const & r ): pn( r.pn ) // may throw -: 400: { -: 401: boost::detail::sp_assert_convertible< Y, T >(); -: 402: -: 403: // it is now safe to copy r.px, as pn(r.pn) did not throw -: 404: px = r.px; -: 405: } -: 406: -: 407: template -: 408: shared_ptr( weak_ptr const & r, boost::detail::sp_nothrow_tag ) -: 409: BOOST_NOEXCEPT : px( 0 ), pn( r.pn, boost::detail::sp_nothrow_tag() ) -: 410: { -: 411: if( !pn.empty() ) -: 412: { -: 413: px = r.px; -: 414: } -: 415: } -: 416: -: 417: template -: 418:#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) -: 419: -: 420: shared_ptr( shared_ptr const & r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) -: 421: -: 422:#else -: 423: -: 424: shared_ptr( shared_ptr const & r ) -: 425: -: 426:#endif -: 427: BOOST_NOEXCEPT : px( r.px ), pn( r.pn ) -: 428: { -: 429: boost::detail::sp_assert_convertible< Y, T >(); -: 430: } -: 431: -: 432: // aliasing -: 433: template< class Y > -: 434: shared_ptr( shared_ptr const & r, element_type * p ) BOOST_NOEXCEPT : px( p ), pn( r.pn ) -: 435: { -: 436: } -: 437: -: 438:#ifndef BOOST_NO_AUTO_PTR -: 439: -: 440: template -: 441: explicit shared_ptr( std::auto_ptr & r ): px(r.get()), pn() -: 442: { -: 443: boost::detail::sp_assert_convertible< Y, T >(); -: 444: -: 445: Y * tmp = r.get(); -: 446: pn = boost::detail::shared_count( r ); -: 447: -: 448: boost::detail::sp_deleter_construct( this, tmp ); -: 449: } -: 450: -: 451:#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) -: 452: -: 453: template -: 454: shared_ptr( std::auto_ptr && r ): px(r.get()), pn() -: 455: { -: 456: boost::detail::sp_assert_convertible< Y, T >(); -: 457: -: 458: Y * tmp = r.get(); -: 459: pn = boost::detail::shared_count( r ); -: 460: -: 461: boost::detail::sp_deleter_construct( this, tmp ); -: 462: } -: 463: -: 464:#elif !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) -: 465: -: 466: template -: 467: explicit shared_ptr( Ap r, typename boost::detail::sp_enable_if_auto_ptr::type = 0 ): px( r.get() ), pn() -: 468: { -: 469: typedef typename Ap::element_type Y; -: 470: -: 471: boost::detail::sp_assert_convertible< Y, T >(); -: 472: -: 473: Y * tmp = r.get(); -: 474: pn = boost::detail::shared_count( r ); -: 475: -: 476: boost::detail::sp_deleter_construct( this, tmp ); -: 477: } -: 478: -: 479:#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -: 480: -: 481:#endif // BOOST_NO_AUTO_PTR -: 482: -: 483:#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) -: 484: -: 485: template< class Y, class D > -: 486: shared_ptr( std::unique_ptr< Y, D > && r ): px( r.get() ), pn() -: 487: { -: 488: boost::detail::sp_assert_convertible< Y, T >(); -: 489: -: 490: typename std::unique_ptr< Y, D >::pointer tmp = r.get(); -: 491: pn = boost::detail::shared_count( r ); -: 492: -: 493: boost::detail::sp_deleter_construct( this, tmp ); -: 494: } -: 495: -: 496:#endif -: 497: -: 498: // assignment -: 499: -: 500: shared_ptr & operator=( shared_ptr const & r ) BOOST_NOEXCEPT -: 501: { -: 502: this_type(r).swap(*this); -: 503: return *this; -: 504: } -: 505: -: 506:#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400) -: 507: -: 508: template -: 509: shared_ptr & operator=(shared_ptr const & r) BOOST_NOEXCEPT -: 510: { -: 511: this_type(r).swap(*this); -: 512: return *this; -: 513: } -: 514: -: 515:#endif -: 516: -: 517:#ifndef BOOST_NO_AUTO_PTR -: 518: -: 519: template -: 520: shared_ptr & operator=( std::auto_ptr & r ) -: 521: { -: 522: this_type( r ).swap( *this ); -: 523: return *this; -: 524: } -: 525: -: 526:#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) -: 527: -: 528: template -: 529: shared_ptr & operator=( std::auto_ptr && r ) -: 530: { -: 531: this_type( static_cast< std::auto_ptr && >( r ) ).swap( *this ); -: 532: return *this; -: 533: } -: 534: -: 535:#elif !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) -: 536: -: 537: template -: 538: typename boost::detail::sp_enable_if_auto_ptr< Ap, shared_ptr & >::type operator=( Ap r ) -: 539: { -: 540: this_type( r ).swap( *this ); -: 541: return *this; -: 542: } -: 543: -: 544:#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -: 545: -: 546:#endif // BOOST_NO_AUTO_PTR -: 547: -: 548:#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) -: 549: -: 550: template -: 551: shared_ptr & operator=( std::unique_ptr && r ) -: 552: { -: 553: this_type( static_cast< std::unique_ptr && >( r ) ).swap(*this); -: 554: return *this; -: 555: } -: 556: -: 557:#endif -: 558: -: 559:// Move support -: 560: -: 561:#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) -: 562: -: 563: shared_ptr( shared_ptr && r ) BOOST_NOEXCEPT : px( r.px ), pn() -: 564: { -: 565: pn.swap( r.pn ); -: 566: r.px = 0; -: 567: } -: 568: -: 569: template -: 570:#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) -: 571: -: 572: shared_ptr( shared_ptr && r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) -: 573: -: 574:#else -: 575: -: 576: shared_ptr( shared_ptr && r ) -: 577: -: 578:#endif -: 579: BOOST_NOEXCEPT : px( r.px ), pn() -: 580: { -: 581: boost::detail::sp_assert_convertible< Y, T >(); -: 582: -: 583: pn.swap( r.pn ); -: 584: r.px = 0; -: 585: } -: 586: -: 587: shared_ptr & operator=( shared_ptr && r ) BOOST_NOEXCEPT -: 588: { -: 589: this_type( static_cast< shared_ptr && >( r ) ).swap( *this ); -: 590: return *this; -: 591: } -: 592: -: 593: template -: 594: shared_ptr & operator=( shared_ptr && r ) BOOST_NOEXCEPT -: 595: { -: 596: this_type( static_cast< shared_ptr && >( r ) ).swap( *this ); -: 597: return *this; -: 598: } -: 599: -: 600:#endif -: 601: -: 602:#if !defined( BOOST_NO_CXX11_NULLPTR ) -: 603: -: 604: shared_ptr & operator=( boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT // never throws -: 605: { -: 606: this_type().swap(*this); -: 607: return *this; -: 608: } -: 609: -: 610:#endif -: 611: -: 612: void reset() BOOST_NOEXCEPT // never throws in 1.30+ -: 613: { -: 614: this_type().swap(*this); -: 615: } -: 616: function _ZN5boost10shared_ptrINS_23basic_wrap_stringstreamIcEEE5resetIS2_EEvPT_ called 0 returned 0% blocks executed 0% #####: 617: template void reset( Y * p ) // Y must be complete -: 618: { #####: 619: BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors branch 0 never executed branch 1 never executed call 2 never executed branch 3 never executed branch 4 never executed call 5 never executed #####: 620: this_type( p ).swap( *this ); call 0 never executed call 1 never executed call 2 never executed call 3 never executed call 4 never executed #####: 621: } -: 622: -: 623: template void reset( Y * p, D d ) -: 624: { -: 625: this_type( p, d ).swap( *this ); -: 626: } -: 627: -: 628: template void reset( Y * p, D d, A a ) -: 629: { -: 630: this_type( p, d, a ).swap( *this ); -: 631: } -: 632: -: 633: template void reset( shared_ptr const & r, element_type * p ) -: 634: { -: 635: this_type( r, p ).swap( *this ); -: 636: } -: 637: -: 638: // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT) function _ZNK5boost10shared_ptrINS_23basic_wrap_stringstreamIcEEEdeEv called 0 returned 0% blocks executed 0% #####: 639: typename boost::detail::sp_dereference< T >::type operator* () const -: 640: { #####: 641: BOOST_ASSERT( px != 0 ); call 0 never executed branch 1 never executed branch 2 never executed call 3 never executed #####: 642: return *px; call 0 never executed call 1 never executed call 2 never executed -: 643: } -: 644: -: 645: // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT) -: 646: typename boost::detail::sp_member_access< T >::type operator-> () const -: 647: { -: 648: BOOST_ASSERT( px != 0 ); -: 649: return px; -: 650: } -: 651: -: 652: // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT) -: 653: typename boost::detail::sp_array_access< T >::type operator[] ( std::ptrdiff_t i ) const -: 654: { -: 655: BOOST_ASSERT( px != 0 ); -: 656: BOOST_ASSERT( i >= 0 && ( i < boost::detail::sp_extent< T >::value || boost::detail::sp_extent< T >::value == 0 ) ); -: 657: -: 658: return static_cast< typename boost::detail::sp_array_access< T >::type >( px[ i ] ); -: 659: } -: 660: -: 661: element_type * get() const BOOST_NOEXCEPT -: 662: { -: 663: return px; -: 664: } -: 665: -: 666:// implicit conversion to "bool" -: 667:#include -: 668: -: 669: bool unique() const BOOST_NOEXCEPT -: 670: { -: 671: return pn.unique(); -: 672: } -: 673: -: 674: long use_count() const BOOST_NOEXCEPT -: 675: { -: 676: return pn.use_count(); -: 677: } -: 678: function _ZN5boost10shared_ptrINS_23basic_wrap_stringstreamIcEEE4swapERS3_ called 0 returned 0% blocks executed 0% #####: 679: void swap( shared_ptr & other ) BOOST_NOEXCEPT -: 680: { #####: 681: std::swap(px, other.px); call 0 never executed call 1 never executed call 2 never executed #####: 682: pn.swap(other.pn); call 0 never executed call 1 never executed call 2 never executed #####: 683: } -: 684: -: 685: template bool owner_before( shared_ptr const & rhs ) const BOOST_NOEXCEPT -: 686: { -: 687: return pn < rhs.pn; -: 688: } -: 689: -: 690: template bool owner_before( weak_ptr const & rhs ) const BOOST_NOEXCEPT -: 691: { -: 692: return pn < rhs.pn; -: 693: } -: 694: -: 695: void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_NOEXCEPT -: 696: { -: 697: return pn.get_deleter( ti ); -: 698: } -: 699: -: 700: void * _internal_get_untyped_deleter() const BOOST_NOEXCEPT -: 701: { -: 702: return pn.get_untyped_deleter(); -: 703: } -: 704: -: 705: bool _internal_equiv( shared_ptr const & r ) const BOOST_NOEXCEPT -: 706: { -: 707: return px == r.px && pn == r.pn; -: 708: } -: 709: -: 710:// Tasteless as this may seem, making all members public allows member templates -: 711:// to work in the absence of member template friends. (Matthew Langston) -: 712: -: 713:#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS -: 714: -: 715:private: -: 716: -: 717: template friend class shared_ptr; -: 718: template friend class weak_ptr; -: 719: -: 720: -: 721:#endif -: 722: -: 723: element_type * px; // contained pointer -: 724: boost::detail::shared_count pn; // reference counter -: 725: -: 726:}; // shared_ptr -: 727: -: 728:template inline bool operator==(shared_ptr const & a, shared_ptr const & b) BOOST_NOEXCEPT -: 729:{ -: 730: return a.get() == b.get(); -: 731:} -: 732: -: 733:template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) BOOST_NOEXCEPT -: 734:{ -: 735: return a.get() != b.get(); -: 736:} -: 737: -: 738:#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 -: 739: -: 740:// Resolve the ambiguity between our op!= and the one in rel_ops -: 741: -: 742:template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) BOOST_NOEXCEPT -: 743:{ -: 744: return a.get() != b.get(); -: 745:} -: 746: -: 747:#endif -: 748: -: 749:#if !defined( BOOST_NO_CXX11_NULLPTR ) -: 750: -: 751:template inline bool operator==( shared_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT -: 752:{ -: 753: return p.get() == 0; -: 754:} -: 755: -: 756:template inline bool operator==( boost::detail::sp_nullptr_t, shared_ptr const & p ) BOOST_NOEXCEPT -: 757:{ -: 758: return p.get() == 0; -: 759:} -: 760: -: 761:template inline bool operator!=( shared_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT -: 762:{ -: 763: return p.get() != 0; -: 764:} -: 765: -: 766:template inline bool operator!=( boost::detail::sp_nullptr_t, shared_ptr const & p ) BOOST_NOEXCEPT -: 767:{ -: 768: return p.get() != 0; -: 769:} -: 770: -: 771:#endif -: 772: -: 773:template inline bool operator<(shared_ptr const & a, shared_ptr const & b) BOOST_NOEXCEPT -: 774:{ -: 775: return a.owner_before( b ); -: 776:} -: 777: -: 778:template inline void swap(shared_ptr & a, shared_ptr & b) BOOST_NOEXCEPT -: 779:{ -: 780: a.swap(b); -: 781:} -: 782: -: 783:template shared_ptr static_pointer_cast( shared_ptr const & r ) BOOST_NOEXCEPT -: 784:{ -: 785: (void) static_cast< T* >( static_cast< U* >( 0 ) ); -: 786: -: 787: typedef typename shared_ptr::element_type E; -: 788: -: 789: E * p = static_cast< E* >( r.get() ); -: 790: return shared_ptr( r, p ); -: 791:} -: 792: -: 793:template shared_ptr const_pointer_cast( shared_ptr const & r ) BOOST_NOEXCEPT -: 794:{ -: 795: (void) const_cast< T* >( static_cast< U* >( 0 ) ); -: 796: -: 797: typedef typename shared_ptr::element_type E; -: 798: -: 799: E * p = const_cast< E* >( r.get() ); -: 800: return shared_ptr( r, p ); -: 801:} -: 802: -: 803:template shared_ptr dynamic_pointer_cast( shared_ptr const & r ) BOOST_NOEXCEPT -: 804:{ -: 805: (void) dynamic_cast< T* >( static_cast< U* >( 0 ) ); -: 806: -: 807: typedef typename shared_ptr::element_type E; -: 808: -: 809: E * p = dynamic_cast< E* >( r.get() ); -: 810: return p? shared_ptr( r, p ): shared_ptr(); -: 811:} -: 812: -: 813:template shared_ptr reinterpret_pointer_cast( shared_ptr const & r ) BOOST_NOEXCEPT -: 814:{ -: 815: (void) reinterpret_cast< T* >( static_cast< U* >( 0 ) ); -: 816: -: 817: typedef typename shared_ptr::element_type E; -: 818: -: 819: E * p = reinterpret_cast< E* >( r.get() ); -: 820: return shared_ptr( r, p ); -: 821:} -: 822: -: 823:// get_pointer() enables boost::mem_fn to recognize shared_ptr -: 824: -: 825:template inline typename shared_ptr::element_type * get_pointer(shared_ptr const & p) BOOST_NOEXCEPT -: 826:{ -: 827: return p.get(); -: 828:} -: 829: -: 830:// operator<< -: 831: -: 832:#if !defined(BOOST_NO_IOSTREAM) -: 833: -: 834:#if defined(BOOST_NO_TEMPLATED_IOSTREAMS) || ( defined(__GNUC__) && (__GNUC__ < 3) ) -: 835: -: 836:template std::ostream & operator<< (std::ostream & os, shared_ptr const & p) -: 837:{ -: 838: os << p.get(); -: 839: return os; -: 840:} -: 841: -: 842:#else -: 843: -: 844:// in STLport's no-iostreams mode no iostream symbols can be used -: 845:#ifndef _STLP_NO_IOSTREAMS -: 846: -: 847:# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300 && __SGI_STL_PORT) -: 848:// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL -: 849:using std::basic_ostream; -: 850:template basic_ostream & operator<< (basic_ostream & os, shared_ptr const & p) -: 851:# else -: 852:template std::basic_ostream & operator<< (std::basic_ostream & os, shared_ptr const & p) -: 853:# endif -: 854:{ -: 855: os << p.get(); -: 856: return os; -: 857:} -: 858: -: 859:#endif // _STLP_NO_IOSTREAMS -: 860: -: 861:#endif // __GNUC__ < 3 -: 862: -: 863:#endif // !defined(BOOST_NO_IOSTREAM) -: 864: -: 865:// get_deleter -: 866: -: 867:namespace detail -: 868:{ -: 869: -: 870:#if ( defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3) ) || \ -: 871: ( defined(__EDG_VERSION__) && BOOST_WORKAROUND(__EDG_VERSION__, <= 238) ) || \ -: 872: ( defined(__HP_aCC) && BOOST_WORKAROUND(__HP_aCC, <= 33500) ) -: 873: -: 874:// g++ 2.9x doesn't allow static_cast(void *) -: 875:// apparently EDG 2.38 and HP aCC A.03.35 also don't accept it -: 876: -: 877:template D * basic_get_deleter(shared_ptr const & p) -: 878:{ -: 879: void const * q = p._internal_get_deleter(BOOST_SP_TYPEID(D)); -: 880: return const_cast(static_cast(q)); -: 881:} -: 882: -: 883:#else -: 884: -: 885:template D * basic_get_deleter( shared_ptr const & p ) BOOST_NOEXCEPT -: 886:{ -: 887: return static_cast( p._internal_get_deleter(BOOST_SP_TYPEID(D)) ); -: 888:} -: 889: -: 890:#endif -: 891: -: 892:class esft2_deleter_wrapper -: 893:{ -: 894:private: -: 895: -: 896: shared_ptr deleter_; -: 897: -: 898:public: -: 899: -: 900: esft2_deleter_wrapper() -: 901: { -: 902: } -: 903: -: 904: template< class T > void set_deleter( shared_ptr const & deleter ) -: 905: { -: 906: deleter_ = deleter; -: 907: } -: 908: -: 909: template D* get_deleter() const BOOST_NOEXCEPT -: 910: { -: 911: return boost::detail::basic_get_deleter( deleter_ ); -: 912: } -: 913: -: 914: template< class T> void operator()( T* ) -: 915: { -: 916: BOOST_ASSERT( deleter_.use_count() <= 1 ); -: 917: deleter_.reset(); -: 918: } -: 919:}; -: 920: -: 921:} // namespace detail -: 922: -: 923:template D * get_deleter( shared_ptr const & p ) BOOST_NOEXCEPT -: 924:{ -: 925: D *del = boost::detail::basic_get_deleter(p); -: 926: -: 927: if(del == 0) -: 928: { -: 929: boost::detail::esft2_deleter_wrapper *del_wrapper = boost::detail::basic_get_deleter(p); -: 930:// The following get_deleter method call is fully qualified because -: 931:// older versions of gcc (2.95, 3.2.3) fail to compile it when written del_wrapper->get_deleter() -: 932: if(del_wrapper) del = del_wrapper->::boost::detail::esft2_deleter_wrapper::get_deleter(); -: 933: } -: 934: -: 935: return del; -: 936:} -: 937: -: 938:// atomic access -: 939: -: 940:#if !defined(BOOST_SP_NO_ATOMIC_ACCESS) -: 941: -: 942:template inline bool atomic_is_lock_free( shared_ptr const * /*p*/ ) BOOST_NOEXCEPT -: 943:{ -: 944: return false; -: 945:} -: 946: -: 947:template shared_ptr atomic_load( shared_ptr const * p ) -: 948:{ -: 949: boost::detail::spinlock_pool<2>::scoped_lock lock( p ); -: 950: return *p; -: 951:} -: 952: -: 953:template inline shared_ptr atomic_load_explicit( shared_ptr const * p, /*memory_order mo*/ int ) -: 954:{ -: 955: return atomic_load( p ); -: 956:} -: 957: -: 958:template void atomic_store( shared_ptr * p, shared_ptr r ) -: 959:{ -: 960: boost::detail::spinlock_pool<2>::scoped_lock lock( p ); -: 961: p->swap( r ); -: 962:} -: 963: -: 964:template inline void atomic_store_explicit( shared_ptr * p, shared_ptr r, /*memory_order mo*/ int ) -: 965:{ -: 966: atomic_store( p, r ); // std::move( r ) -: 967:} -: 968: -: 969:template shared_ptr atomic_exchange( shared_ptr * p, shared_ptr r ) -: 970:{ -: 971: boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p ); -: 972: -: 973: sp.lock(); -: 974: p->swap( r ); -: 975: sp.unlock(); -: 976: -: 977: return r; // return std::move( r ) -: 978:} -: 979: -: 980:template shared_ptr atomic_exchange_explicit( shared_ptr * p, shared_ptr r, /*memory_order mo*/ int ) -: 981:{ -: 982: return atomic_exchange( p, r ); // std::move( r ) -: 983:} -: 984: -: 985:template bool atomic_compare_exchange( shared_ptr * p, shared_ptr * v, shared_ptr w ) -: 986:{ -: 987: boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p ); -: 988: -: 989: sp.lock(); -: 990: -: 991: if( p->_internal_equiv( *v ) ) -: 992: { -: 993: p->swap( w ); -: 994: -: 995: sp.unlock(); -: 996: -: 997: return true; -: 998: } -: 999: else -: 1000: { -: 1001: shared_ptr tmp( *p ); -: 1002: -: 1003: sp.unlock(); -: 1004: -: 1005: tmp.swap( *v ); -: 1006: return false; -: 1007: } -: 1008:} -: 1009: -: 1010:template inline bool atomic_compare_exchange_explicit( shared_ptr * p, shared_ptr * v, shared_ptr w, /*memory_order success*/ int, /*memory_order failure*/ int ) -: 1011:{ -: 1012: return atomic_compare_exchange( p, v, w ); // std::move( w ) -: 1013:} -: 1014: -: 1015:#endif // !defined(BOOST_SP_NO_ATOMIC_ACCESS) -: 1016: -: 1017:// hash_value -: 1018: -: 1019:template< class T > struct hash; -: 1020: -: 1021:template< class T > std::size_t hash_value( boost::shared_ptr const & p ) BOOST_NOEXCEPT -: 1022:{ -: 1023: return boost::hash< T* >()( p.get() ); -: 1024:} -: 1025: -: 1026:} // namespace boost -: 1027: -: 1028:#endif // #ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED <<<<<< EOF # path=/home/travis/build/richelbilderbeek/AminoAcidFighter/#usr#include#c++#5#bits#stl_algo.h.gcov -: 0:Source:/usr/include/c++/5/bits/stl_algo.h -: 0:Programs:19 -: 1:// Algorithm implementation -*- C++ -*- -: 2: -: 3:// Copyright (C) 2001-2015 Free Software Foundation, Inc. -: 4:// -: 5:// This file is part of the GNU ISO C++ Library. This library is free -: 6:// software; you can redistribute it and/or modify it under the -: 7:// terms of the GNU General Public License as published by the -: 8:// Free Software Foundation; either version 3, or (at your option) -: 9:// any later version. -: 10: -: 11:// This library is distributed in the hope that it will be useful, -: 12:// but WITHOUT ANY WARRANTY; without even the implied warranty of -: 13:// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -: 14:// GNU General Public License for more details. -: 15: -: 16:// Under Section 7 of GPL version 3, you are granted additional -: 17:// permissions described in the GCC Runtime Library Exception, version -: 18:// 3.1, as published by the Free Software Foundation. -: 19: -: 20:// You should have received a copy of the GNU General Public License and -: 21:// a copy of the GCC Runtime Library Exception along with this program; -: 22:// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -: 23:// . -: 24: -: 25:/* -: 26: * -: 27: * Copyright (c) 1994 -: 28: * Hewlett-Packard Company -: 29: * -: 30: * Permission to use, copy, modify, distribute and sell this software -: 31: * and its documentation for any purpose is hereby granted without fee, -: 32: * provided that the above copyright notice appear in all copies and -: 33: * that both that copyright notice and this permission notice appear -: 34: * in supporting documentation. Hewlett-Packard Company makes no -: 35: * representations about the suitability of this software for any -: 36: * purpose. It is provided "as is" without express or implied warranty. -: 37: * -: 38: * -: 39: * Copyright (c) 1996 -: 40: * Silicon Graphics Computer Systems, Inc. -: 41: * -: 42: * Permission to use, copy, modify, distribute and sell this software -: 43: * and its documentation for any purpose is hereby granted without fee, -: 44: * provided that the above copyright notice appear in all copies and -: 45: * that both that copyright notice and this permission notice appear -: 46: * in supporting documentation. Silicon Graphics makes no -: 47: * representations about the suitability of this software for any -: 48: * purpose. It is provided "as is" without express or implied warranty. -: 49: */ -: 50: -: 51:/** @file bits/stl_algo.h -: 52: * This is an internal header file, included by other library headers. -: 53: * Do not attempt to use it directly. @headername{algorithm} -: 54: */ -: 55: -: 56:#ifndef _STL_ALGO_H -: 57:#define _STL_ALGO_H 1 -: 58: -: 59:#include // for rand -: 60:#include -: 61:#include -: 62:#include // for _Temporary_buffer -: 63:#include -: 64: -: 65:#if __cplusplus >= 201103L -: 66:#include // for std::uniform_int_distribution -: 67:#endif -: 68: -: 69:// See concept_check.h for the __glibcxx_*_requires macros. -: 70: -: 71:namespace std _GLIBCXX_VISIBILITY(default) -: 72:{ -: 73:_GLIBCXX_BEGIN_NAMESPACE_VERSION -: 74: -: 75: /// Swaps the median value of *__a, *__b and *__c under __comp to *__result -: 76: template -: 77: void -: 78: __move_median_to_first(_Iterator __result,_Iterator __a, _Iterator __b, -: 79: _Iterator __c, _Compare __comp) -: 80: { -: 81: if (__comp(__a, __b)) -: 82: { -: 83: if (__comp(__b, __c)) -: 84: std::iter_swap(__result, __b); -: 85: else if (__comp(__a, __c)) -: 86: std::iter_swap(__result, __c); -: 87: else -: 88: std::iter_swap(__result, __a); -: 89: } -: 90: else if (__comp(__a, __c)) -: 91: std::iter_swap(__result, __a); -: 92: else if (__comp(__b, __c)) -: 93: std::iter_swap(__result, __c); -: 94: else -: 95: std::iter_swap(__result, __b); -: 96: } -: 97: -: 98: /// This is an overload used by find algos for the Input Iterator case. -: 99: template -: 100: inline _InputIterator -: 101: __find_if(_InputIterator __first, _InputIterator __last, -: 102: _Predicate __pred, input_iterator_tag) -: 103: { -: 104: while (__first != __last && !__pred(__first)) -: 105: ++__first; -: 106: return __first; -: 107: } -: 108: -: 109: /// This is an overload used by find algos for the RAI case. -: 110: template -: 111: _RandomAccessIterator -: 112: __find_if(_RandomAccessIterator __first, _RandomAccessIterator __last, -: 113: _Predicate __pred, random_access_iterator_tag) -: 114: { -: 115: typename iterator_traits<_RandomAccessIterator>::difference_type -: 116: __trip_count = (__last - __first) >> 2; -: 117: -: 118: for (; __trip_count > 0; --__trip_count) -: 119: { -: 120: if (__pred(__first)) -: 121: return __first; -: 122: ++__first; -: 123: -: 124: if (__pred(__first)) -: 125: return __first; -: 126: ++__first; -: 127: -: 128: if (__pred(__first)) -: 129: return __first; -: 130: ++__first; -: 131: -: 132: if (__pred(__first)) -: 133: return __first; -: 134: ++__first; -: 135: } -: 136: -: 137: switch (__last - __first) -: 138: { -: 139: case 3: -: 140: if (__pred(__first)) -: 141: return __first; -: 142: ++__first; -: 143: case 2: -: 144: if (__pred(__first)) -: 145: return __first; -: 146: ++__first; -: 147: case 1: -: 148: if (__pred(__first)) -: 149: return __first; -: 150: ++__first; -: 151: case 0: -: 152: default: -: 153: return __last; -: 154: } -: 155: } -: 156: -: 157: template -: 158: inline _Iterator -: 159: __find_if(_Iterator __first, _Iterator __last, _Predicate __pred) -: 160: { -: 161: return __find_if(__first, __last, __pred, -: 162: std::__iterator_category(__first)); -: 163: } -: 164: -: 165: /// Provided for stable_partition to use. -: 166: template -: 167: inline _InputIterator -: 168: __find_if_not(_InputIterator __first, _InputIterator __last, -: 169: _Predicate __pred) -: 170: { -: 171: return std::__find_if(__first, __last, -: 172: __gnu_cxx::__ops::__negate(__pred), -: 173: std::__iterator_category(__first)); -: 174: } -: 175: -: 176: /// Like find_if_not(), but uses and updates a count of the -: 177: /// remaining range length instead of comparing against an end -: 178: /// iterator. -: 179: template -: 180: _InputIterator -: 181: __find_if_not_n(_InputIterator __first, _Distance& __len, _Predicate __pred) -: 182: { -: 183: for (; __len; --__len, ++__first) -: 184: if (!__pred(__first)) -: 185: break; -: 186: return __first; -: 187: } -: 188: -: 189: // set_difference -: 190: // set_intersection -: 191: // set_symmetric_difference -: 192: // set_union -: 193: // for_each -: 194: // find -: 195: // find_if -: 196: // find_first_of -: 197: // adjacent_find -: 198: // count -: 199: // count_if -: 200: // search -: 201: -: 202: template -: 204: _ForwardIterator1 -: 205: __search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, -: 206: _ForwardIterator2 __first2, _ForwardIterator2 __last2, -: 207: _BinaryPredicate __predicate) -: 208: { -: 209: // Test for empty ranges -: 210: if (__first1 == __last1 || __first2 == __last2) -: 211: return __first1; -: 212: -: 213: // Test for a pattern of length 1. -: 214: _ForwardIterator2 __p1(__first2); -: 215: if (++__p1 == __last2) -: 216: return std::__find_if(__first1, __last1, -: 217: __gnu_cxx::__ops::__iter_comp_iter(__predicate, __first2)); -: 218: -: 219: // General case. -: 220: _ForwardIterator2 __p; -: 221: _ForwardIterator1 __current = __first1; -: 222: -: 223: for (;;) -: 224: { -: 225: __first1 = -: 226: std::__find_if(__first1, __last1, -: 227: __gnu_cxx::__ops::__iter_comp_iter(__predicate, __first2)); -: 228: -: 229: if (__first1 == __last1) -: 230: return __last1; -: 231: -: 232: __p = __p1; -: 233: __current = __first1; -: 234: if (++__current == __last1) -: 235: return __last1; -: 236: -: 237: while (__predicate(__current, __p)) -: 238: { -: 239: if (++__p == __last2) -: 240: return __first1; -: 241: if (++__current == __last1) -: 242: return __last1; -: 243: } -: 244: ++__first1; -: 245: } -: 246: return __first1; -: 247: } -: 248: -: 249: // search_n -: 250: -: 251: /** -: 252: * This is an helper function for search_n overloaded for forward iterators. -: 253: */ -: 254: template -: 256: _ForwardIterator -: 257: __search_n_aux(_ForwardIterator __first, _ForwardIterator __last, -: 258: _Integer __count, _UnaryPredicate __unary_pred, -: 259: std::forward_iterator_tag) -: 260: { -: 261: __first = std::__find_if(__first, __last, __unary_pred); -: 262: while (__first != __last) -: 263: { -: 264: typename iterator_traits<_ForwardIterator>::difference_type -: 265: __n = __count; -: 266: _ForwardIterator __i = __first; -: 267: ++__i; -: 268: while (__i != __last && __n != 1 && __unary_pred(__i)) -: 269: { -: 270: ++__i; -: 271: --__n; -: 272: } -: 273: if (__n == 1) -: 274: return __first; -: 275: if (__i == __last) -: 276: return __last; -: 277: __first = std::__find_if(++__i, __last, __unary_pred); -: 278: } -: 279: return __last; -: 280: } -: 281: -: 282: /** -: 283: * This is an helper function for search_n overloaded for random access -: 284: * iterators. -: 285: */ -: 286: template -: 288: _RandomAccessIter -: 289: __search_n_aux(_RandomAccessIter __first, _RandomAccessIter __last, -: 290: _Integer __count, _UnaryPredicate __unary_pred, -: 291: std::random_access_iterator_tag) -: 292: { -: 293: typedef typename std::iterator_traits<_RandomAccessIter>::difference_type -: 294: _DistanceType; -: 295: -: 296: _DistanceType __tailSize = __last - __first; -: 297: _DistanceType __remainder = __count; -: 298: -: 299: while (__remainder <= __tailSize) // the main loop... -: 300: { -: 301: __first += __remainder; -: 302: __tailSize -= __remainder; -: 303: // __first here is always pointing to one past the last element of -: 304: // next possible match. -: 305: _RandomAccessIter __backTrack = __first; -: 306: while (__unary_pred(--__backTrack)) -: 307: { -: 308: if (--__remainder == 0) -: 309: return (__first - __count); // Success -: 310: } -: 311: __remainder = __count + 1 - (__first - __backTrack); -: 312: } -: 313: return __last; // Failure -: 314: } -: 315: -: 316: template -: 318: _ForwardIterator -: 319: __search_n(_ForwardIterator __first, _ForwardIterator __last, -: 320: _Integer __count, -: 321: _UnaryPredicate __unary_pred) -: 322: { -: 323: if (__count <= 0) -: 324: return __first; -: 325: -: 326: if (__count == 1) -: 327: return std::__find_if(__first, __last, __unary_pred); -: 328: -: 329: return std::__search_n_aux(__first, __last, __count, __unary_pred, -: 330: std::__iterator_category(__first)); -: 331: } -: 332: -: 333: // find_end for forward iterators. -: 334: template -: 336: _ForwardIterator1 -: 337: __find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, -: 338: _ForwardIterator2 __first2, _ForwardIterator2 __last2, -: 339: forward_iterator_tag, forward_iterator_tag, -: 340: _BinaryPredicate __comp) -: 341: { -: 342: if (__first2 == __last2) -: 343: return __last1; -: 344: -: 345: _ForwardIterator1 __result = __last1; -: 346: while (1) -: 347: { -: 348: _ForwardIterator1 __new_result -: 349: = std::__search(__first1, __last1, __first2, __last2, __comp); -: 350: if (__new_result == __last1) -: 351: return __result; -: 352: else -: 353: { -: 354: __result = __new_result; -: 355: __first1 = __new_result; -: 356: ++__first1; -: 357: } -: 358: } -: 359: } -: 360: -: 361: // find_end for bidirectional iterators (much faster). -: 362: template -: 364: _BidirectionalIterator1 -: 365: __find_end(_BidirectionalIterator1 __first1, -: 366: _BidirectionalIterator1 __last1, -: 367: _BidirectionalIterator2 __first2, -: 368: _BidirectionalIterator2 __last2, -: 369: bidirectional_iterator_tag, bidirectional_iterator_tag, -: 370: _BinaryPredicate __comp) -: 371: { -: 372: // concept requirements -: 373: __glibcxx_function_requires(_BidirectionalIteratorConcept< -: 374: _BidirectionalIterator1>) -: 375: __glibcxx_function_requires(_BidirectionalIteratorConcept< -: 376: _BidirectionalIterator2>) -: 377: -: 378: typedef reverse_iterator<_BidirectionalIterator1> _RevIterator1; -: 379: typedef reverse_iterator<_BidirectionalIterator2> _RevIterator2; -: 380: -: 381: _RevIterator1 __rlast1(__first1); -: 382: _RevIterator2 __rlast2(__first2); -: 383: _RevIterator1 __rresult = std::__search(_RevIterator1(__last1), __rlast1, -: 384: _RevIterator2(__last2), __rlast2, -: 385: __comp); -: 386: -: 387: if (__rresult == __rlast1) -: 388: return __last1; -: 389: else -: 390: { -: 391: _BidirectionalIterator1 __result = __rresult.base(); -: 392: std::advance(__result, -std::distance(__first2, __last2)); -: 393: return __result; -: 394: } -: 395: } -: 396: -: 397: /** -: 398: * @brief Find last matching subsequence in a sequence. -: 399: * @ingroup non_mutating_algorithms -: 400: * @param __first1 Start of range to search. -: 401: * @param __last1 End of range to search. -: 402: * @param __first2 Start of sequence to match. -: 403: * @param __last2 End of sequence to match. -: 404: * @return The last iterator @c i in the range -: 405: * @p [__first1,__last1-(__last2-__first2)) such that @c *(i+N) == -: 406: * @p *(__first2+N) for each @c N in the range @p -: 407: * [0,__last2-__first2), or @p __last1 if no such iterator exists. -: 408: * -: 409: * Searches the range @p [__first1,__last1) for a sub-sequence that -: 410: * compares equal value-by-value with the sequence given by @p -: 411: * [__first2,__last2) and returns an iterator to the __first -: 412: * element of the sub-sequence, or @p __last1 if the sub-sequence -: 413: * is not found. The sub-sequence will be the last such -: 414: * subsequence contained in [__first1,__last1). -: 415: * -: 416: * Because the sub-sequence must lie completely within the range @p -: 417: * [__first1,__last1) it must start at a position less than @p -: 418: * __last1-(__last2-__first2) where @p __last2-__first2 is the -: 419: * length of the sub-sequence. This means that the returned -: 420: * iterator @c i will be in the range @p -: 421: * [__first1,__last1-(__last2-__first2)) -: 422: */ -: 423: template -: 424: inline _ForwardIterator1 -: 425: find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, -: 426: _ForwardIterator2 __first2, _ForwardIterator2 __last2) -: 427: { -: 428: // concept requirements -: 429: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) -: 430: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) -: 431: __glibcxx_function_requires(_EqualOpConcept< -: 432: typename iterator_traits<_ForwardIterator1>::value_type, -: 433: typename iterator_traits<_ForwardIterator2>::value_type>) -: 434: __glibcxx_requires_valid_range(__first1, __last1); -: 435: __glibcxx_requires_valid_range(__first2, __last2); -: 436: -: 437: return std::__find_end(__first1, __last1, __first2, __last2, -: 438: std::__iterator_category(__first1), -: 439: std::__iterator_category(__first2), -: 440: __gnu_cxx::__ops::__iter_equal_to_iter()); -: 441: } -: 442: -: 443: /** -: 444: * @brief Find last matching subsequence in a sequence using a predicate. -: 445: * @ingroup non_mutating_algorithms -: 446: * @param __first1 Start of range to search. -: 447: * @param __last1 End of range to search. -: 448: * @param __first2 Start of sequence to match. -: 449: * @param __last2 End of sequence to match. -: 450: * @param __comp The predicate to use. -: 451: * @return The last iterator @c i in the range @p -: 452: * [__first1,__last1-(__last2-__first2)) such that @c -: 453: * predicate(*(i+N), @p (__first2+N)) is true for each @c N in the -: 454: * range @p [0,__last2-__first2), or @p __last1 if no such iterator -: 455: * exists. -: 456: * -: 457: * Searches the range @p [__first1,__last1) for a sub-sequence that -: 458: * compares equal value-by-value with the sequence given by @p -: 459: * [__first2,__last2) using comp as a predicate and returns an -: 460: * iterator to the first element of the sub-sequence, or @p __last1 -: 461: * if the sub-sequence is not found. The sub-sequence will be the -: 462: * last such subsequence contained in [__first,__last1). -: 463: * -: 464: * Because the sub-sequence must lie completely within the range @p -: 465: * [__first1,__last1) it must start at a position less than @p -: 466: * __last1-(__last2-__first2) where @p __last2-__first2 is the -: 467: * length of the sub-sequence. This means that the returned -: 468: * iterator @c i will be in the range @p -: 469: * [__first1,__last1-(__last2-__first2)) -: 470: */ -: 471: template -: 473: inline _ForwardIterator1 -: 474: find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, -: 475: _ForwardIterator2 __first2, _ForwardIterator2 __last2, -: 476: _BinaryPredicate __comp) -: 477: { -: 478: // concept requirements -: 479: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) -: 480: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) -: 481: __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, -: 482: typename iterator_traits<_ForwardIterator1>::value_type, -: 483: typename iterator_traits<_ForwardIterator2>::value_type>) -: 484: __glibcxx_requires_valid_range(__first1, __last1); -: 485: __glibcxx_requires_valid_range(__first2, __last2); -: 486: -: 487: return std::__find_end(__first1, __last1, __first2, __last2, -: 488: std::__iterator_category(__first1), -: 489: std::__iterator_category(__first2), -: 490: __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 491: } -: 492: -: 493:#if __cplusplus >= 201103L -: 494: /** -: 495: * @brief Checks that a predicate is true for all the elements -: 496: * of a sequence. -: 497: * @ingroup non_mutating_algorithms -: 498: * @param __first An input iterator. -: 499: * @param __last An input iterator. -: 500: * @param __pred A predicate. -: 501: * @return True if the check is true, false otherwise. -: 502: * -: 503: * Returns true if @p __pred is true for each element in the range -: 504: * @p [__first,__last), and false otherwise. -: 505: */ -: 506: template -: 507: inline bool -: 508: all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) -: 509: { return __last == std::find_if_not(__first, __last, __pred); } -: 510: -: 511: /** -: 512: * @brief Checks that a predicate is false for all the elements -: 513: * of a sequence. -: 514: * @ingroup non_mutating_algorithms -: 515: * @param __first An input iterator. -: 516: * @param __last An input iterator. -: 517: * @param __pred A predicate. -: 518: * @return True if the check is true, false otherwise. -: 519: * -: 520: * Returns true if @p __pred is false for each element in the range -: 521: * @p [__first,__last), and false otherwise. -: 522: */ -: 523: template -: 524: inline bool -: 525: none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) -: 526: { return __last == _GLIBCXX_STD_A::find_if(__first, __last, __pred); } -: 527: -: 528: /** -: 529: * @brief Checks that a predicate is false for at least an element -: 530: * of a sequence. -: 531: * @ingroup non_mutating_algorithms -: 532: * @param __first An input iterator. -: 533: * @param __last An input iterator. -: 534: * @param __pred A predicate. -: 535: * @return True if the check is true, false otherwise. -: 536: * -: 537: * Returns true if an element exists in the range @p -: 538: * [__first,__last) such that @p __pred is true, and false -: 539: * otherwise. -: 540: */ -: 541: template -: 542: inline bool -: 543: any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) -: 544: { return !std::none_of(__first, __last, __pred); } -: 545: -: 546: /** -: 547: * @brief Find the first element in a sequence for which a -: 548: * predicate is false. -: 549: * @ingroup non_mutating_algorithms -: 550: * @param __first An input iterator. -: 551: * @param __last An input iterator. -: 552: * @param __pred A predicate. -: 553: * @return The first iterator @c i in the range @p [__first,__last) -: 554: * such that @p __pred(*i) is false, or @p __last if no such iterator exists. -: 555: */ -: 556: template -: 557: inline _InputIterator -: 558: find_if_not(_InputIterator __first, _InputIterator __last, -: 559: _Predicate __pred) -: 560: { -: 561: // concept requirements -: 562: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 563: __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, -: 564: typename iterator_traits<_InputIterator>::value_type>) -: 565: __glibcxx_requires_valid_range(__first, __last); -: 566: return std::__find_if_not(__first, __last, -: 567: __gnu_cxx::__ops::__pred_iter(__pred)); -: 568: } -: 569: -: 570: /** -: 571: * @brief Checks whether the sequence is partitioned. -: 572: * @ingroup mutating_algorithms -: 573: * @param __first An input iterator. -: 574: * @param __last An input iterator. -: 575: * @param __pred A predicate. -: 576: * @return True if the range @p [__first,__last) is partioned by @p __pred, -: 577: * i.e. if all elements that satisfy @p __pred appear before those that -: 578: * do not. -: 579: */ -: 580: template -: 581: inline bool -: 582: is_partitioned(_InputIterator __first, _InputIterator __last, -: 583: _Predicate __pred) -: 584: { -: 585: __first = std::find_if_not(__first, __last, __pred); -: 586: return std::none_of(__first, __last, __pred); -: 587: } -: 588: -: 589: /** -: 590: * @brief Find the partition point of a partitioned range. -: 591: * @ingroup mutating_algorithms -: 592: * @param __first An iterator. -: 593: * @param __last Another iterator. -: 594: * @param __pred A predicate. -: 595: * @return An iterator @p mid such that @p all_of(__first, mid, __pred) -: 596: * and @p none_of(mid, __last, __pred) are both true. -: 597: */ -: 598: template -: 599: _ForwardIterator -: 600: partition_point(_ForwardIterator __first, _ForwardIterator __last, -: 601: _Predicate __pred) -: 602: { -: 603: // concept requirements -: 604: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 605: __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, -: 606: typename iterator_traits<_ForwardIterator>::value_type>) -: 607: -: 608: // A specific debug-mode test will be necessary... -: 609: __glibcxx_requires_valid_range(__first, __last); -: 610: -: 611: typedef typename iterator_traits<_ForwardIterator>::difference_type -: 612: _DistanceType; -: 613: -: 614: _DistanceType __len = std::distance(__first, __last); -: 615: _DistanceType __half; -: 616: _ForwardIterator __middle; -: 617: -: 618: while (__len > 0) -: 619: { -: 620: __half = __len >> 1; -: 621: __middle = __first; -: 622: std::advance(__middle, __half); -: 623: if (__pred(*__middle)) -: 624: { -: 625: __first = __middle; -: 626: ++__first; -: 627: __len = __len - __half - 1; -: 628: } -: 629: else -: 630: __len = __half; -: 631: } -: 632: return __first; -: 633: } -: 634:#endif -: 635: -: 636: template -: 638: _OutputIterator -: 639: __remove_copy_if(_InputIterator __first, _InputIterator __last, -: 640: _OutputIterator __result, _Predicate __pred) -: 641: { -: 642: for (; __first != __last; ++__first) -: 643: if (!__pred(__first)) -: 644: { -: 645: *__result = *__first; -: 646: ++__result; -: 647: } -: 648: return __result; -: 649: } -: 650: -: 651: /** -: 652: * @brief Copy a sequence, removing elements of a given value. -: 653: * @ingroup mutating_algorithms -: 654: * @param __first An input iterator. -: 655: * @param __last An input iterator. -: 656: * @param __result An output iterator. -: 657: * @param __value The value to be removed. -: 658: * @return An iterator designating the end of the resulting sequence. -: 659: * -: 660: * Copies each element in the range @p [__first,__last) not equal -: 661: * to @p __value to the range beginning at @p __result. -: 662: * remove_copy() is stable, so the relative order of elements that -: 663: * are copied is unchanged. -: 664: */ -: 665: template -: 666: inline _OutputIterator -: 667: remove_copy(_InputIterator __first, _InputIterator __last, -: 668: _OutputIterator __result, const _Tp& __value) -: 669: { -: 670: // concept requirements -: 671: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 672: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 673: typename iterator_traits<_InputIterator>::value_type>) -: 674: __glibcxx_function_requires(_EqualOpConcept< -: 675: typename iterator_traits<_InputIterator>::value_type, _Tp>) -: 676: __glibcxx_requires_valid_range(__first, __last); -: 677: -: 678: return std::__remove_copy_if(__first, __last, __result, -: 679: __gnu_cxx::__ops::__iter_equals_val(__value)); -: 680: } -: 681: -: 682: /** -: 683: * @brief Copy a sequence, removing elements for which a predicate is true. -: 684: * @ingroup mutating_algorithms -: 685: * @param __first An input iterator. -: 686: * @param __last An input iterator. -: 687: * @param __result An output iterator. -: 688: * @param __pred A predicate. -: 689: * @return An iterator designating the end of the resulting sequence. -: 690: * -: 691: * Copies each element in the range @p [__first,__last) for which -: 692: * @p __pred returns false to the range beginning at @p __result. -: 693: * -: 694: * remove_copy_if() is stable, so the relative order of elements that are -: 695: * copied is unchanged. -: 696: */ -: 697: template -: 699: inline _OutputIterator -: 700: remove_copy_if(_InputIterator __first, _InputIterator __last, -: 701: _OutputIterator __result, _Predicate __pred) -: 702: { -: 703: // concept requirements -: 704: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 705: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 706: typename iterator_traits<_InputIterator>::value_type>) -: 707: __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, -: 708: typename iterator_traits<_InputIterator>::value_type>) -: 709: __glibcxx_requires_valid_range(__first, __last); -: 710: -: 711: return std::__remove_copy_if(__first, __last, __result, -: 712: __gnu_cxx::__ops::__pred_iter(__pred)); -: 713: } -: 714: -: 715:#if __cplusplus >= 201103L -: 716: /** -: 717: * @brief Copy the elements of a sequence for which a predicate is true. -: 718: * @ingroup mutating_algorithms -: 719: * @param __first An input iterator. -: 720: * @param __last An input iterator. -: 721: * @param __result An output iterator. -: 722: * @param __pred A predicate. -: 723: * @return An iterator designating the end of the resulting sequence. -: 724: * -: 725: * Copies each element in the range @p [__first,__last) for which -: 726: * @p __pred returns true to the range beginning at @p __result. -: 727: * -: 728: * copy_if() is stable, so the relative order of elements that are -: 729: * copied is unchanged. -: 730: */ -: 731: template -: 733: _OutputIterator -: 734: copy_if(_InputIterator __first, _InputIterator __last, -: 735: _OutputIterator __result, _Predicate __pred) -: 736: { -: 737: // concept requirements -: 738: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 739: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 740: typename iterator_traits<_InputIterator>::value_type>) -: 741: __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, -: 742: typename iterator_traits<_InputIterator>::value_type>) -: 743: __glibcxx_requires_valid_range(__first, __last); -: 744: -: 745: for (; __first != __last; ++__first) -: 746: if (__pred(*__first)) -: 747: { -: 748: *__result = *__first; -: 749: ++__result; -: 750: } -: 751: return __result; -: 752: } -: 753: -: 754: template -: 755: _OutputIterator -: 756: __copy_n(_InputIterator __first, _Size __n, -: 757: _OutputIterator __result, input_iterator_tag) -: 758: { -: 759: if (__n > 0) -: 760: { -: 761: while (true) -: 762: { -: 763: *__result = *__first; -: 764: ++__result; -: 765: if (--__n > 0) -: 766: ++__first; -: 767: else -: 768: break; -: 769: } -: 770: } -: 771: return __result; -: 772: } -: 773: -: 774: template -: 776: inline _OutputIterator -: 777: __copy_n(_RandomAccessIterator __first, _Size __n, -: 778: _OutputIterator __result, random_access_iterator_tag) -: 779: { return std::copy(__first, __first + __n, __result); } -: 780: -: 781: /** -: 782: * @brief Copies the range [first,first+n) into [result,result+n). -: 783: * @ingroup mutating_algorithms -: 784: * @param __first An input iterator. -: 785: * @param __n The number of elements to copy. -: 786: * @param __result An output iterator. -: 787: * @return result+n. -: 788: * -: 789: * This inline function will boil down to a call to @c memmove whenever -: 790: * possible. Failing that, if random access iterators are passed, then the -: 791: * loop count will be known (and therefore a candidate for compiler -: 792: * optimizations such as unrolling). -: 793: */ -: 794: template -: 795: inline _OutputIterator -: 796: copy_n(_InputIterator __first, _Size __n, _OutputIterator __result) -: 797: { -: 798: // concept requirements -: 799: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 800: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 801: typename iterator_traits<_InputIterator>::value_type>) -: 802: -: 803: return std::__copy_n(__first, __n, __result, -: 804: std::__iterator_category(__first)); -: 805: } -: 806: -: 807: /** -: 808: * @brief Copy the elements of a sequence to separate output sequences -: 809: * depending on the truth value of a predicate. -: 810: * @ingroup mutating_algorithms -: 811: * @param __first An input iterator. -: 812: * @param __last An input iterator. -: 813: * @param __out_true An output iterator. -: 814: * @param __out_false An output iterator. -: 815: * @param __pred A predicate. -: 816: * @return A pair designating the ends of the resulting sequences. -: 817: * -: 818: * Copies each element in the range @p [__first,__last) for which -: 819: * @p __pred returns true to the range beginning at @p out_true -: 820: * and each element for which @p __pred returns false to @p __out_false. -: 821: */ -: 822: template -: 824: pair<_OutputIterator1, _OutputIterator2> -: 825: partition_copy(_InputIterator __first, _InputIterator __last, -: 826: _OutputIterator1 __out_true, _OutputIterator2 __out_false, -: 827: _Predicate __pred) -: 828: { -: 829: // concept requirements -: 830: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 831: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator1, -: 832: typename iterator_traits<_InputIterator>::value_type>) -: 833: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator2, -: 834: typename iterator_traits<_InputIterator>::value_type>) -: 835: __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, -: 836: typename iterator_traits<_InputIterator>::value_type>) -: 837: __glibcxx_requires_valid_range(__first, __last); -: 838: -: 839: for (; __first != __last; ++__first) -: 840: if (__pred(*__first)) -: 841: { -: 842: *__out_true = *__first; -: 843: ++__out_true; -: 844: } -: 845: else -: 846: { -: 847: *__out_false = *__first; -: 848: ++__out_false; -: 849: } -: 850: -: 851: return pair<_OutputIterator1, _OutputIterator2>(__out_true, __out_false); -: 852: } -: 853:#endif -: 854: -: 855: template -: 856: _ForwardIterator -: 857: __remove_if(_ForwardIterator __first, _ForwardIterator __last, -: 858: _Predicate __pred) -: 859: { -: 860: __first = std::__find_if(__first, __last, __pred); -: 861: if (__first == __last) -: 862: return __first; -: 863: _ForwardIterator __result = __first; -: 864: ++__first; -: 865: for (; __first != __last; ++__first) -: 866: if (!__pred(__first)) -: 867: { -: 868: *__result = _GLIBCXX_MOVE(*__first); -: 869: ++__result; -: 870: } -: 871: return __result; -: 872: } -: 873: -: 874: /** -: 875: * @brief Remove elements from a sequence. -: 876: * @ingroup mutating_algorithms -: 877: * @param __first An input iterator. -: 878: * @param __last An input iterator. -: 879: * @param __value The value to be removed. -: 880: * @return An iterator designating the end of the resulting sequence. -: 881: * -: 882: * All elements equal to @p __value are removed from the range -: 883: * @p [__first,__last). -: 884: * -: 885: * remove() is stable, so the relative order of elements that are -: 886: * not removed is unchanged. -: 887: * -: 888: * Elements between the end of the resulting sequence and @p __last -: 889: * are still present, but their value is unspecified. -: 890: */ -: 891: template -: 892: inline _ForwardIterator -: 893: remove(_ForwardIterator __first, _ForwardIterator __last, -: 894: const _Tp& __value) -: 895: { -: 896: // concept requirements -: 897: __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< -: 898: _ForwardIterator>) -: 899: __glibcxx_function_requires(_EqualOpConcept< -: 900: typename iterator_traits<_ForwardIterator>::value_type, _Tp>) -: 901: __glibcxx_requires_valid_range(__first, __last); -: 902: -: 903: return std::__remove_if(__first, __last, -: 904: __gnu_cxx::__ops::__iter_equals_val(__value)); -: 905: } -: 906: -: 907: /** -: 908: * @brief Remove elements from a sequence using a predicate. -: 909: * @ingroup mutating_algorithms -: 910: * @param __first A forward iterator. -: 911: * @param __last A forward iterator. -: 912: * @param __pred A predicate. -: 913: * @return An iterator designating the end of the resulting sequence. -: 914: * -: 915: * All elements for which @p __pred returns true are removed from the range -: 916: * @p [__first,__last). -: 917: * -: 918: * remove_if() is stable, so the relative order of elements that are -: 919: * not removed is unchanged. -: 920: * -: 921: * Elements between the end of the resulting sequence and @p __last -: 922: * are still present, but their value is unspecified. -: 923: */ -: 924: template -: 925: inline _ForwardIterator -: 926: remove_if(_ForwardIterator __first, _ForwardIterator __last, -: 927: _Predicate __pred) -: 928: { -: 929: // concept requirements -: 930: __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< -: 931: _ForwardIterator>) -: 932: __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, -: 933: typename iterator_traits<_ForwardIterator>::value_type>) -: 934: __glibcxx_requires_valid_range(__first, __last); -: 935: -: 936: return std::__remove_if(__first, __last, -: 937: __gnu_cxx::__ops::__pred_iter(__pred)); -: 938: } -: 939: -: 940: template -: 941: _ForwardIterator -: 942: __adjacent_find(_ForwardIterator __first, _ForwardIterator __last, -: 943: _BinaryPredicate __binary_pred) -: 944: { -: 945: if (__first == __last) -: 946: return __last; -: 947: _ForwardIterator __next = __first; -: 948: while (++__next != __last) -: 949: { -: 950: if (__binary_pred(__first, __next)) -: 951: return __first; -: 952: __first = __next; -: 953: } -: 954: return __last; -: 955: } -: 956: -: 957: template -: 958: _ForwardIterator -: 959: __unique(_ForwardIterator __first, _ForwardIterator __last, -: 960: _BinaryPredicate __binary_pred) -: 961: { -: 962: // Skip the beginning, if already unique. -: 963: __first = std::__adjacent_find(__first, __last, __binary_pred); -: 964: if (__first == __last) -: 965: return __last; -: 966: -: 967: // Do the real copy work. -: 968: _ForwardIterator __dest = __first; -: 969: ++__first; -: 970: while (++__first != __last) -: 971: if (!__binary_pred(__dest, __first)) -: 972: *++__dest = _GLIBCXX_MOVE(*__first); -: 973: return ++__dest; -: 974: } -: 975: -: 976: /** -: 977: * @brief Remove consecutive duplicate values from a sequence. -: 978: * @ingroup mutating_algorithms -: 979: * @param __first A forward iterator. -: 980: * @param __last A forward iterator. -: 981: * @return An iterator designating the end of the resulting sequence. -: 982: * -: 983: * Removes all but the first element from each group of consecutive -: 984: * values that compare equal. -: 985: * unique() is stable, so the relative order of elements that are -: 986: * not removed is unchanged. -: 987: * Elements between the end of the resulting sequence and @p __last -: 988: * are still present, but their value is unspecified. -: 989: */ -: 990: template -: 991: inline _ForwardIterator -: 992: unique(_ForwardIterator __first, _ForwardIterator __last) -: 993: { -: 994: // concept requirements -: 995: __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< -: 996: _ForwardIterator>) -: 997: __glibcxx_function_requires(_EqualityComparableConcept< -: 998: typename iterator_traits<_ForwardIterator>::value_type>) -: 999: __glibcxx_requires_valid_range(__first, __last); -: 1000: -: 1001: return std::__unique(__first, __last, -: 1002: __gnu_cxx::__ops::__iter_equal_to_iter()); -: 1003: } -: 1004: -: 1005: /** -: 1006: * @brief Remove consecutive values from a sequence using a predicate. -: 1007: * @ingroup mutating_algorithms -: 1008: * @param __first A forward iterator. -: 1009: * @param __last A forward iterator. -: 1010: * @param __binary_pred A binary predicate. -: 1011: * @return An iterator designating the end of the resulting sequence. -: 1012: * -: 1013: * Removes all but the first element from each group of consecutive -: 1014: * values for which @p __binary_pred returns true. -: 1015: * unique() is stable, so the relative order of elements that are -: 1016: * not removed is unchanged. -: 1017: * Elements between the end of the resulting sequence and @p __last -: 1018: * are still present, but their value is unspecified. -: 1019: */ -: 1020: template -: 1021: inline _ForwardIterator -: 1022: unique(_ForwardIterator __first, _ForwardIterator __last, -: 1023: _BinaryPredicate __binary_pred) -: 1024: { -: 1025: // concept requirements -: 1026: __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< -: 1027: _ForwardIterator>) -: 1028: __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, -: 1029: typename iterator_traits<_ForwardIterator>::value_type, -: 1030: typename iterator_traits<_ForwardIterator>::value_type>) -: 1031: __glibcxx_requires_valid_range(__first, __last); -: 1032: -: 1033: return std::__unique(__first, __last, -: 1034: __gnu_cxx::__ops::__iter_comp_iter(__binary_pred)); -: 1035: } -: 1036: -: 1037: /** -: 1038: * This is an uglified -: 1039: * unique_copy(_InputIterator, _InputIterator, _OutputIterator, -: 1040: * _BinaryPredicate) -: 1041: * overloaded for forward iterators and output iterator as result. -: 1042: */ -: 1043: template -: 1045: _OutputIterator -: 1046: __unique_copy(_ForwardIterator __first, _ForwardIterator __last, -: 1047: _OutputIterator __result, _BinaryPredicate __binary_pred, -: 1048: forward_iterator_tag, output_iterator_tag) -: 1049: { -: 1050: // concept requirements -- iterators already checked -: 1051: __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, -: 1052: typename iterator_traits<_ForwardIterator>::value_type, -: 1053: typename iterator_traits<_ForwardIterator>::value_type>) -: 1054: -: 1055: _ForwardIterator __next = __first; -: 1056: *__result = *__first; -: 1057: while (++__next != __last) -: 1058: if (!__binary_pred(__first, __next)) -: 1059: { -: 1060: __first = __next; -: 1061: *++__result = *__first; -: 1062: } -: 1063: return ++__result; -: 1064: } -: 1065: -: 1066: /** -: 1067: * This is an uglified -: 1068: * unique_copy(_InputIterator, _InputIterator, _OutputIterator, -: 1069: * _BinaryPredicate) -: 1070: * overloaded for input iterators and output iterator as result. -: 1071: */ -: 1072: template -: 1074: _OutputIterator -: 1075: __unique_copy(_InputIterator __first, _InputIterator __last, -: 1076: _OutputIterator __result, _BinaryPredicate __binary_pred, -: 1077: input_iterator_tag, output_iterator_tag) -: 1078: { -: 1079: // concept requirements -- iterators already checked -: 1080: __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, -: 1081: typename iterator_traits<_InputIterator>::value_type, -: 1082: typename iterator_traits<_InputIterator>::value_type>) -: 1083: -: 1084: typename iterator_traits<_InputIterator>::value_type __value = *__first; -: 1085: __decltype(__gnu_cxx::__ops::__iter_comp_val(__binary_pred)) -: 1086: __rebound_pred -: 1087: = __gnu_cxx::__ops::__iter_comp_val(__binary_pred); -: 1088: *__result = __value; -: 1089: while (++__first != __last) -: 1090: if (!__rebound_pred(__first, __value)) -: 1091: { -: 1092: __value = *__first; -: 1093: *++__result = __value; -: 1094: } -: 1095: return ++__result; -: 1096: } -: 1097: -: 1098: /** -: 1099: * This is an uglified -: 1100: * unique_copy(_InputIterator, _InputIterator, _OutputIterator, -: 1101: * _BinaryPredicate) -: 1102: * overloaded for input iterators and forward iterator as result. -: 1103: */ -: 1104: template -: 1106: _ForwardIterator -: 1107: __unique_copy(_InputIterator __first, _InputIterator __last, -: 1108: _ForwardIterator __result, _BinaryPredicate __binary_pred, -: 1109: input_iterator_tag, forward_iterator_tag) -: 1110: { -: 1111: // concept requirements -- iterators already checked -: 1112: __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, -: 1113: typename iterator_traits<_ForwardIterator>::value_type, -: 1114: typename iterator_traits<_InputIterator>::value_type>) -: 1115: *__result = *__first; -: 1116: while (++__first != __last) -: 1117: if (!__binary_pred(__result, __first)) -: 1118: *++__result = *__first; -: 1119: return ++__result; -: 1120: } -: 1121: -: 1122: /** -: 1123: * This is an uglified reverse(_BidirectionalIterator, -: 1124: * _BidirectionalIterator) -: 1125: * overloaded for bidirectional iterators. -: 1126: */ -: 1127: template -: 1128: void -: 1129: __reverse(_BidirectionalIterator __first, _BidirectionalIterator __last, -: 1130: bidirectional_iterator_tag) -: 1131: { -: 1132: while (true) -: 1133: if (__first == __last || __first == --__last) -: 1134: return; -: 1135: else -: 1136: { -: 1137: std::iter_swap(__first, __last); -: 1138: ++__first; -: 1139: } -: 1140: } -: 1141: -: 1142: /** -: 1143: * This is an uglified reverse(_BidirectionalIterator, -: 1144: * _BidirectionalIterator) -: 1145: * overloaded for random access iterators. -: 1146: */ -: 1147: template -: 1148: void -: 1149: __reverse(_RandomAccessIterator __first, _RandomAccessIterator __last, -: 1150: random_access_iterator_tag) -: 1151: { -: 1152: if (__first == __last) -: 1153: return; -: 1154: --__last; -: 1155: while (__first < __last) -: 1156: { -: 1157: std::iter_swap(__first, __last); -: 1158: ++__first; -: 1159: --__last; -: 1160: } -: 1161: } -: 1162: -: 1163: /** -: 1164: * @brief Reverse a sequence. -: 1165: * @ingroup mutating_algorithms -: 1166: * @param __first A bidirectional iterator. -: 1167: * @param __last A bidirectional iterator. -: 1168: * @return reverse() returns no value. -: 1169: * -: 1170: * Reverses the order of the elements in the range @p [__first,__last), -: 1171: * so that the first element becomes the last etc. -: 1172: * For every @c i such that @p 0<=i<=(__last-__first)/2), @p reverse() -: 1173: * swaps @p *(__first+i) and @p *(__last-(i+1)) -: 1174: */ -: 1175: template -: 1176: inline void -: 1177: reverse(_BidirectionalIterator __first, _BidirectionalIterator __last) -: 1178: { -: 1179: // concept requirements -: 1180: __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept< -: 1181: _BidirectionalIterator>) -: 1182: __glibcxx_requires_valid_range(__first, __last); -: 1183: std::__reverse(__first, __last, std::__iterator_category(__first)); -: 1184: } -: 1185: -: 1186: /** -: 1187: * @brief Copy a sequence, reversing its elements. -: 1188: * @ingroup mutating_algorithms -: 1189: * @param __first A bidirectional iterator. -: 1190: * @param __last A bidirectional iterator. -: 1191: * @param __result An output iterator. -: 1192: * @return An iterator designating the end of the resulting sequence. -: 1193: * -: 1194: * Copies the elements in the range @p [__first,__last) to the -: 1195: * range @p [__result,__result+(__last-__first)) such that the -: 1196: * order of the elements is reversed. For every @c i such that @p -: 1197: * 0<=i<=(__last-__first), @p reverse_copy() performs the -: 1198: * assignment @p *(__result+(__last-__first)-1-i) = *(__first+i). -: 1199: * The ranges @p [__first,__last) and @p -: 1200: * [__result,__result+(__last-__first)) must not overlap. -: 1201: */ -: 1202: template -: 1203: _OutputIterator -: 1204: reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, -: 1205: _OutputIterator __result) -: 1206: { -: 1207: // concept requirements -: 1208: __glibcxx_function_requires(_BidirectionalIteratorConcept< -: 1209: _BidirectionalIterator>) -: 1210: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 1211: typename iterator_traits<_BidirectionalIterator>::value_type>) -: 1212: __glibcxx_requires_valid_range(__first, __last); -: 1213: -: 1214: while (__first != __last) -: 1215: { -: 1216: --__last; -: 1217: *__result = *__last; -: 1218: ++__result; -: 1219: } -: 1220: return __result; -: 1221: } -: 1222: -: 1223: /** -: 1224: * This is a helper function for the rotate algorithm specialized on RAIs. -: 1225: * It returns the greatest common divisor of two integer values. -: 1226: */ -: 1227: template -: 1228: _EuclideanRingElement -: 1229: __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n) -: 1230: { -: 1231: while (__n != 0) -: 1232: { -: 1233: _EuclideanRingElement __t = __m % __n; -: 1234: __m = __n; -: 1235: __n = __t; -: 1236: } -: 1237: return __m; -: 1238: } -: 1239: -: 1240: inline namespace _V2 -: 1241: { -: 1242: -: 1243: /// This is a helper function for the rotate algorithm. -: 1244: template -: 1245: _ForwardIterator -: 1246: __rotate(_ForwardIterator __first, -: 1247: _ForwardIterator __middle, -: 1248: _ForwardIterator __last, -: 1249: forward_iterator_tag) -: 1250: { -: 1251: if (__first == __middle) -: 1252: return __last; -: 1253: else if (__last == __middle) -: 1254: return __first; -: 1255: -: 1256: _ForwardIterator __first2 = __middle; -: 1257: do -: 1258: { -: 1259: std::iter_swap(__first, __first2); -: 1260: ++__first; -: 1261: ++__first2; -: 1262: if (__first == __middle) -: 1263: __middle = __first2; -: 1264: } -: 1265: while (__first2 != __last); -: 1266: -: 1267: _ForwardIterator __ret = __first; -: 1268: -: 1269: __first2 = __middle; -: 1270: -: 1271: while (__first2 != __last) -: 1272: { -: 1273: std::iter_swap(__first, __first2); -: 1274: ++__first; -: 1275: ++__first2; -: 1276: if (__first == __middle) -: 1277: __middle = __first2; -: 1278: else if (__first2 == __last) -: 1279: __first2 = __middle; -: 1280: } -: 1281: return __ret; -: 1282: } -: 1283: -: 1284: /// This is a helper function for the rotate algorithm. -: 1285: template -: 1286: _BidirectionalIterator -: 1287: __rotate(_BidirectionalIterator __first, -: 1288: _BidirectionalIterator __middle, -: 1289: _BidirectionalIterator __last, -: 1290: bidirectional_iterator_tag) -: 1291: { -: 1292: // concept requirements -: 1293: __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept< -: 1294: _BidirectionalIterator>) -: 1295: -: 1296: if (__first == __middle) -: 1297: return __last; -: 1298: else if (__last == __middle) -: 1299: return __first; -: 1300: -: 1301: std::__reverse(__first, __middle, bidirectional_iterator_tag()); -: 1302: std::__reverse(__middle, __last, bidirectional_iterator_tag()); -: 1303: -: 1304: while (__first != __middle && __middle != __last) -: 1305: { -: 1306: std::iter_swap(__first, --__last); -: 1307: ++__first; -: 1308: } -: 1309: -: 1310: if (__first == __middle) -: 1311: { -: 1312: std::__reverse(__middle, __last, bidirectional_iterator_tag()); -: 1313: return __last; -: 1314: } -: 1315: else -: 1316: { -: 1317: std::__reverse(__first, __middle, bidirectional_iterator_tag()); -: 1318: return __first; -: 1319: } -: 1320: } -: 1321: -: 1322: /// This is a helper function for the rotate algorithm. -: 1323: template -: 1324: _RandomAccessIterator -: 1325: __rotate(_RandomAccessIterator __first, -: 1326: _RandomAccessIterator __middle, -: 1327: _RandomAccessIterator __last, -: 1328: random_access_iterator_tag) -: 1329: { -: 1330: // concept requirements -: 1331: __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< -: 1332: _RandomAccessIterator>) -: 1333: -: 1334: if (__first == __middle) -: 1335: return __last; -: 1336: else if (__last == __middle) -: 1337: return __first; -: 1338: -: 1339: typedef typename iterator_traits<_RandomAccessIterator>::difference_type -: 1340: _Distance; -: 1341: typedef typename iterator_traits<_RandomAccessIterator>::value_type -: 1342: _ValueType; -: 1343: -: 1344: _Distance __n = __last - __first; -: 1345: _Distance __k = __middle - __first; -: 1346: -: 1347: if (__k == __n - __k) -: 1348: { -: 1349: std::swap_ranges(__first, __middle, __middle); -: 1350: return __middle; -: 1351: } -: 1352: -: 1353: _RandomAccessIterator __p = __first; -: 1354: _RandomAccessIterator __ret = __first + (__last - __middle); -: 1355: -: 1356: for (;;) -: 1357: { -: 1358: if (__k < __n - __k) -: 1359: { -: 1360: if (__is_pod(_ValueType) && __k == 1) -: 1361: { -: 1362: _ValueType __t = _GLIBCXX_MOVE(*__p); -: 1363: _GLIBCXX_MOVE3(__p + 1, __p + __n, __p); -: 1364: *(__p + __n - 1) = _GLIBCXX_MOVE(__t); -: 1365: return __ret; -: 1366: } -: 1367: _RandomAccessIterator __q = __p + __k; -: 1368: for (_Distance __i = 0; __i < __n - __k; ++ __i) -: 1369: { -: 1370: std::iter_swap(__p, __q); -: 1371: ++__p; -: 1372: ++__q; -: 1373: } -: 1374: __n %= __k; -: 1375: if (__n == 0) -: 1376: return __ret; -: 1377: std::swap(__n, __k); -: 1378: __k = __n - __k; -: 1379: } -: 1380: else -: 1381: { -: 1382: __k = __n - __k; -: 1383: if (__is_pod(_ValueType) && __k == 1) -: 1384: { -: 1385: _ValueType __t = _GLIBCXX_MOVE(*(__p + __n - 1)); -: 1386: _GLIBCXX_MOVE_BACKWARD3(__p, __p + __n - 1, __p + __n); -: 1387: *__p = _GLIBCXX_MOVE(__t); -: 1388: return __ret; -: 1389: } -: 1390: _RandomAccessIterator __q = __p + __n; -: 1391: __p = __q - __k; -: 1392: for (_Distance __i = 0; __i < __n - __k; ++ __i) -: 1393: { -: 1394: --__p; -: 1395: --__q; -: 1396: std::iter_swap(__p, __q); -: 1397: } -: 1398: __n %= __k; -: 1399: if (__n == 0) -: 1400: return __ret; -: 1401: std::swap(__n, __k); -: 1402: } -: 1403: } -: 1404: } -: 1405: -: 1406: // _GLIBCXX_RESOLVE_LIB_DEFECTS -: 1407: // DR 488. rotate throws away useful information -: 1408: /** -: 1409: * @brief Rotate the elements of a sequence. -: 1410: * @ingroup mutating_algorithms -: 1411: * @param __first A forward iterator. -: 1412: * @param __middle A forward iterator. -: 1413: * @param __last A forward iterator. -: 1414: * @return first + (last - middle). -: 1415: * -: 1416: * Rotates the elements of the range @p [__first,__last) by -: 1417: * @p (__middle - __first) positions so that the element at @p __middle -: 1418: * is moved to @p __first, the element at @p __middle+1 is moved to -: 1419: * @p __first+1 and so on for each element in the range -: 1420: * @p [__first,__last). -: 1421: * -: 1422: * This effectively swaps the ranges @p [__first,__middle) and -: 1423: * @p [__middle,__last). -: 1424: * -: 1425: * Performs -: 1426: * @p *(__first+(n+(__last-__middle))%(__last-__first))=*(__first+n) -: 1427: * for each @p n in the range @p [0,__last-__first). -: 1428: */ -: 1429: template -: 1430: inline _ForwardIterator -: 1431: rotate(_ForwardIterator __first, _ForwardIterator __middle, -: 1432: _ForwardIterator __last) -: 1433: { -: 1434: // concept requirements -: 1435: __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< -: 1436: _ForwardIterator>) -: 1437: __glibcxx_requires_valid_range(__first, __middle); -: 1438: __glibcxx_requires_valid_range(__middle, __last); -: 1439: -: 1440: return std::__rotate(__first, __middle, __last, -: 1441: std::__iterator_category(__first)); -: 1442: } -: 1443: -: 1444: } // namespace _V2 -: 1445: -: 1446: /** -: 1447: * @brief Copy a sequence, rotating its elements. -: 1448: * @ingroup mutating_algorithms -: 1449: * @param __first A forward iterator. -: 1450: * @param __middle A forward iterator. -: 1451: * @param __last A forward iterator. -: 1452: * @param __result An output iterator. -: 1453: * @return An iterator designating the end of the resulting sequence. -: 1454: * -: 1455: * Copies the elements of the range @p [__first,__last) to the -: 1456: * range beginning at @result, rotating the copied elements by -: 1457: * @p (__middle-__first) positions so that the element at @p __middle -: 1458: * is moved to @p __result, the element at @p __middle+1 is moved -: 1459: * to @p __result+1 and so on for each element in the range @p -: 1460: * [__first,__last). -: 1461: * -: 1462: * Performs -: 1463: * @p *(__result+(n+(__last-__middle))%(__last-__first))=*(__first+n) -: 1464: * for each @p n in the range @p [0,__last-__first). -: 1465: */ -: 1466: template -: 1467: inline _OutputIterator -: 1468: rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, -: 1469: _ForwardIterator __last, _OutputIterator __result) -: 1470: { -: 1471: // concept requirements -: 1472: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 1473: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 1474: typename iterator_traits<_ForwardIterator>::value_type>) -: 1475: __glibcxx_requires_valid_range(__first, __middle); -: 1476: __glibcxx_requires_valid_range(__middle, __last); -: 1477: -: 1478: return std::copy(__first, __middle, -: 1479: std::copy(__middle, __last, __result)); -: 1480: } -: 1481: -: 1482: /// This is a helper function... -: 1483: template -: 1484: _ForwardIterator -: 1485: __partition(_ForwardIterator __first, _ForwardIterator __last, -: 1486: _Predicate __pred, forward_iterator_tag) -: 1487: { -: 1488: if (__first == __last) -: 1489: return __first; -: 1490: -: 1491: while (__pred(*__first)) -: 1492: if (++__first == __last) -: 1493: return __first; -: 1494: -: 1495: _ForwardIterator __next = __first; -: 1496: -: 1497: while (++__next != __last) -: 1498: if (__pred(*__next)) -: 1499: { -: 1500: std::iter_swap(__first, __next); -: 1501: ++__first; -: 1502: } -: 1503: -: 1504: return __first; -: 1505: } -: 1506: -: 1507: /// This is a helper function... -: 1508: template -: 1509: _BidirectionalIterator -: 1510: __partition(_BidirectionalIterator __first, _BidirectionalIterator __last, -: 1511: _Predicate __pred, bidirectional_iterator_tag) -: 1512: { -: 1513: while (true) -: 1514: { -: 1515: while (true) -: 1516: if (__first == __last) -: 1517: return __first; -: 1518: else if (__pred(*__first)) -: 1519: ++__first; -: 1520: else -: 1521: break; -: 1522: --__last; -: 1523: while (true) -: 1524: if (__first == __last) -: 1525: return __first; -: 1526: else if (!bool(__pred(*__last))) -: 1527: --__last; -: 1528: else -: 1529: break; -: 1530: std::iter_swap(__first, __last); -: 1531: ++__first; -: 1532: } -: 1533: } -: 1534: -: 1535: // partition -: 1536: -: 1537: /// This is a helper function... -: 1538: /// Requires __first != __last and !__pred(__first) -: 1539: /// and __len == distance(__first, __last). -: 1540: /// -: 1541: /// !__pred(__first) allows us to guarantee that we don't -: 1542: /// move-assign an element onto itself. -: 1543: template -: 1545: _ForwardIterator -: 1546: __stable_partition_adaptive(_ForwardIterator __first, -: 1547: _ForwardIterator __last, -: 1548: _Predicate __pred, _Distance __len, -: 1549: _Pointer __buffer, -: 1550: _Distance __buffer_size) -: 1551: { -: 1552: if (__len == 1) -: 1553: return __first; -: 1554: -: 1555: if (__len <= __buffer_size) -: 1556: { -: 1557: _ForwardIterator __result1 = __first; -: 1558: _Pointer __result2 = __buffer; -: 1559: -: 1560: // The precondition guarantees that !__pred(__first), so -: 1561: // move that element to the buffer before starting the loop. -: 1562: // This ensures that we only call __pred once per element. -: 1563: *__result2 = _GLIBCXX_MOVE(*__first); -: 1564: ++__result2; -: 1565: ++__first; -: 1566: for (; __first != __last; ++__first) -: 1567: if (__pred(__first)) -: 1568: { -: 1569: *__result1 = _GLIBCXX_MOVE(*__first); -: 1570: ++__result1; -: 1571: } -: 1572: else -: 1573: { -: 1574: *__result2 = _GLIBCXX_MOVE(*__first); -: 1575: ++__result2; -: 1576: } -: 1577: -: 1578: _GLIBCXX_MOVE3(__buffer, __result2, __result1); -: 1579: return __result1; -: 1580: } -: 1581: -: 1582: _ForwardIterator __middle = __first; -: 1583: std::advance(__middle, __len / 2); -: 1584: _ForwardIterator __left_split = -: 1585: std::__stable_partition_adaptive(__first, __middle, __pred, -: 1586: __len / 2, __buffer, -: 1587: __buffer_size); -: 1588: -: 1589: // Advance past true-predicate values to satisfy this -: 1590: // function's preconditions. -: 1591: _Distance __right_len = __len - __len / 2; -: 1592: _ForwardIterator __right_split = -: 1593: std::__find_if_not_n(__middle, __right_len, __pred); -: 1594: -: 1595: if (__right_len) -: 1596: __right_split = -: 1597: std::__stable_partition_adaptive(__right_split, __last, __pred, -: 1598: __right_len, -: 1599: __buffer, __buffer_size); -: 1600: -: 1601: std::rotate(__left_split, __middle, __right_split); -: 1602: std::advance(__left_split, std::distance(__middle, __right_split)); -: 1603: return __left_split; -: 1604: } -: 1605: -: 1606: template -: 1607: _ForwardIterator -: 1608: __stable_partition(_ForwardIterator __first, _ForwardIterator __last, -: 1609: _Predicate __pred) -: 1610: { -: 1611: __first = std::__find_if_not(__first, __last, __pred); -: 1612: -: 1613: if (__first == __last) -: 1614: return __first; -: 1615: -: 1616: typedef typename iterator_traits<_ForwardIterator>::value_type -: 1617: _ValueType; -: 1618: typedef typename iterator_traits<_ForwardIterator>::difference_type -: 1619: _DistanceType; -: 1620: -: 1621: _Temporary_buffer<_ForwardIterator, _ValueType> __buf(__first, __last); -: 1622: return -: 1623: std::__stable_partition_adaptive(__first, __last, __pred, -: 1624: _DistanceType(__buf.requested_size()), -: 1625: __buf.begin(), -: 1626: _DistanceType(__buf.size())); -: 1627: } -: 1628: -: 1629: /** -: 1630: * @brief Move elements for which a predicate is true to the beginning -: 1631: * of a sequence, preserving relative ordering. -: 1632: * @ingroup mutating_algorithms -: 1633: * @param __first A forward iterator. -: 1634: * @param __last A forward iterator. -: 1635: * @param __pred A predicate functor. -: 1636: * @return An iterator @p middle such that @p __pred(i) is true for each -: 1637: * iterator @p i in the range @p [first,middle) and false for each @p i -: 1638: * in the range @p [middle,last). -: 1639: * -: 1640: * Performs the same function as @p partition() with the additional -: 1641: * guarantee that the relative ordering of elements in each group is -: 1642: * preserved, so any two elements @p x and @p y in the range -: 1643: * @p [__first,__last) such that @p __pred(x)==__pred(y) will have the same -: 1644: * relative ordering after calling @p stable_partition(). -: 1645: */ -: 1646: template -: 1647: inline _ForwardIterator -: 1648: stable_partition(_ForwardIterator __first, _ForwardIterator __last, -: 1649: _Predicate __pred) -: 1650: { -: 1651: // concept requirements -: 1652: __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< -: 1653: _ForwardIterator>) -: 1654: __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, -: 1655: typename iterator_traits<_ForwardIterator>::value_type>) -: 1656: __glibcxx_requires_valid_range(__first, __last); -: 1657: -: 1658: return std::__stable_partition(__first, __last, -: 1659: __gnu_cxx::__ops::__pred_iter(__pred)); -: 1660: } -: 1661: -: 1662: /// This is a helper function for the sort routines. -: 1663: template -: 1664: void -: 1665: __heap_select(_RandomAccessIterator __first, -: 1666: _RandomAccessIterator __middle, -: 1667: _RandomAccessIterator __last, _Compare __comp) -: 1668: { -: 1669: std::__make_heap(__first, __middle, __comp); -: 1670: for (_RandomAccessIterator __i = __middle; __i < __last; ++__i) -: 1671: if (__comp(__i, __first)) -: 1672: std::__pop_heap(__first, __middle, __i, __comp); -: 1673: } -: 1674: -: 1675: // partial_sort -: 1676: -: 1677: template -: 1679: _RandomAccessIterator -: 1680: __partial_sort_copy(_InputIterator __first, _InputIterator __last, -: 1681: _RandomAccessIterator __result_first, -: 1682: _RandomAccessIterator __result_last, -: 1683: _Compare __comp) -: 1684: { -: 1685: typedef typename iterator_traits<_InputIterator>::value_type -: 1686: _InputValueType; -: 1687: typedef iterator_traits<_RandomAccessIterator> _RItTraits; -: 1688: typedef typename _RItTraits::difference_type _DistanceType; -: 1689: -: 1690: if (__result_first == __result_last) -: 1691: return __result_last; -: 1692: _RandomAccessIterator __result_real_last = __result_first; -: 1693: while (__first != __last && __result_real_last != __result_last) -: 1694: { -: 1695: *__result_real_last = *__first; -: 1696: ++__result_real_last; -: 1697: ++__first; -: 1698: } -: 1699: -: 1700: std::__make_heap(__result_first, __result_real_last, __comp); -: 1701: while (__first != __last) -: 1702: { -: 1703: if (__comp(__first, __result_first)) -: 1704: std::__adjust_heap(__result_first, _DistanceType(0), -: 1705: _DistanceType(__result_real_last -: 1706: - __result_first), -: 1707: _InputValueType(*__first), __comp); -: 1708: ++__first; -: 1709: } -: 1710: std::__sort_heap(__result_first, __result_real_last, __comp); -: 1711: return __result_real_last; -: 1712: } -: 1713: -: 1714: /** -: 1715: * @brief Copy the smallest elements of a sequence. -: 1716: * @ingroup sorting_algorithms -: 1717: * @param __first An iterator. -: 1718: * @param __last Another iterator. -: 1719: * @param __result_first A random-access iterator. -: 1720: * @param __result_last Another random-access iterator. -: 1721: * @return An iterator indicating the end of the resulting sequence. -: 1722: * -: 1723: * Copies and sorts the smallest N values from the range @p [__first,__last) -: 1724: * to the range beginning at @p __result_first, where the number of -: 1725: * elements to be copied, @p N, is the smaller of @p (__last-__first) and -: 1726: * @p (__result_last-__result_first). -: 1727: * After the sort if @e i and @e j are iterators in the range -: 1728: * @p [__result_first,__result_first+N) such that i precedes j then -: 1729: * *j<*i is false. -: 1730: * The value returned is @p __result_first+N. -: 1731: */ -: 1732: template -: 1733: inline _RandomAccessIterator -: 1734: partial_sort_copy(_InputIterator __first, _InputIterator __last, -: 1735: _RandomAccessIterator __result_first, -: 1736: _RandomAccessIterator __result_last) -: 1737: { -: 1738: typedef typename iterator_traits<_InputIterator>::value_type -: 1739: _InputValueType; -: 1740: typedef typename iterator_traits<_RandomAccessIterator>::value_type -: 1741: _OutputValueType; -: 1742: typedef typename iterator_traits<_RandomAccessIterator>::difference_type -: 1743: _DistanceType; -: 1744: -: 1745: // concept requirements -: 1746: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 1747: __glibcxx_function_requires(_ConvertibleConcept<_InputValueType, -: 1748: _OutputValueType>) -: 1749: __glibcxx_function_requires(_LessThanOpConcept<_InputValueType, -: 1750: _OutputValueType>) -: 1751: __glibcxx_function_requires(_LessThanComparableConcept<_OutputValueType>) -: 1752: __glibcxx_requires_valid_range(__first, __last); -: 1753: __glibcxx_requires_valid_range(__result_first, __result_last); -: 1754: -: 1755: return std::__partial_sort_copy(__first, __last, -: 1756: __result_first, __result_last, -: 1757: __gnu_cxx::__ops::__iter_less_iter()); -: 1758: } -: 1759: -: 1760: /** -: 1761: * @brief Copy the smallest elements of a sequence using a predicate for -: 1762: * comparison. -: 1763: * @ingroup sorting_algorithms -: 1764: * @param __first An input iterator. -: 1765: * @param __last Another input iterator. -: 1766: * @param __result_first A random-access iterator. -: 1767: * @param __result_last Another random-access iterator. -: 1768: * @param __comp A comparison functor. -: 1769: * @return An iterator indicating the end of the resulting sequence. -: 1770: * -: 1771: * Copies and sorts the smallest N values from the range @p [__first,__last) -: 1772: * to the range beginning at @p result_first, where the number of -: 1773: * elements to be copied, @p N, is the smaller of @p (__last-__first) and -: 1774: * @p (__result_last-__result_first). -: 1775: * After the sort if @e i and @e j are iterators in the range -: 1776: * @p [__result_first,__result_first+N) such that i precedes j then -: 1777: * @p __comp(*j,*i) is false. -: 1778: * The value returned is @p __result_first+N. -: 1779: */ -: 1780: template -: 1782: inline _RandomAccessIterator -: 1783: partial_sort_copy(_InputIterator __first, _InputIterator __last, -: 1784: _RandomAccessIterator __result_first, -: 1785: _RandomAccessIterator __result_last, -: 1786: _Compare __comp) -: 1787: { -: 1788: typedef typename iterator_traits<_InputIterator>::value_type -: 1789: _InputValueType; -: 1790: typedef typename iterator_traits<_RandomAccessIterator>::value_type -: 1791: _OutputValueType; -: 1792: typedef typename iterator_traits<_RandomAccessIterator>::difference_type -: 1793: _DistanceType; -: 1794: -: 1795: // concept requirements -: 1796: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 1797: __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< -: 1798: _RandomAccessIterator>) -: 1799: __glibcxx_function_requires(_ConvertibleConcept<_InputValueType, -: 1800: _OutputValueType>) -: 1801: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 1802: _InputValueType, _OutputValueType>) -: 1803: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 1804: _OutputValueType, _OutputValueType>) -: 1805: __glibcxx_requires_valid_range(__first, __last); -: 1806: __glibcxx_requires_valid_range(__result_first, __result_last); -: 1807: -: 1808: return std::__partial_sort_copy(__first, __last, -: 1809: __result_first, __result_last, -: 1810: __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 1811: } -: 1812: -: 1813: /// This is a helper function for the sort routine. -: 1814: template -: 1815: void -: 1816: __unguarded_linear_insert(_RandomAccessIterator __last, -: 1817: _Compare __comp) -: 1818: { -: 1819: typename iterator_traits<_RandomAccessIterator>::value_type -: 1820: __val = _GLIBCXX_MOVE(*__last); -: 1821: _RandomAccessIterator __next = __last; -: 1822: --__next; -: 1823: while (__comp(__val, __next)) -: 1824: { -: 1825: *__last = _GLIBCXX_MOVE(*__next); -: 1826: __last = __next; -: 1827: --__next; -: 1828: } -: 1829: *__last = _GLIBCXX_MOVE(__val); -: 1830: } -: 1831: -: 1832: /// This is a helper function for the sort routine. -: 1833: template -: 1834: void -: 1835: __insertion_sort(_RandomAccessIterator __first, -: 1836: _RandomAccessIterator __last, _Compare __comp) -: 1837: { -: 1838: if (__first == __last) return; -: 1839: -: 1840: for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) -: 1841: { -: 1842: if (__comp(__i, __first)) -: 1843: { -: 1844: typename iterator_traits<_RandomAccessIterator>::value_type -: 1845: __val = _GLIBCXX_MOVE(*__i); -: 1846: _GLIBCXX_MOVE_BACKWARD3(__first, __i, __i + 1); -: 1847: *__first = _GLIBCXX_MOVE(__val); -: 1848: } -: 1849: else -: 1850: std::__unguarded_linear_insert(__i, -: 1851: __gnu_cxx::__ops::__val_comp_iter(__comp)); -: 1852: } -: 1853: } -: 1854: -: 1855: /// This is a helper function for the sort routine. -: 1856: template -: 1857: inline void -: 1858: __unguarded_insertion_sort(_RandomAccessIterator __first, -: 1859: _RandomAccessIterator __last, _Compare __comp) -: 1860: { -: 1861: for (_RandomAccessIterator __i = __first; __i != __last; ++__i) -: 1862: std::__unguarded_linear_insert(__i, -: 1863: __gnu_cxx::__ops::__val_comp_iter(__comp)); -: 1864: } -: 1865: -: 1866: /** -: 1867: * @doctodo -: 1868: * This controls some aspect of the sort routines. -: 1869: */ -: 1870: enum { _S_threshold = 16 }; -: 1871: -: 1872: /// This is a helper function for the sort routine. -: 1873: template -: 1874: void -: 1875: __final_insertion_sort(_RandomAccessIterator __first, -: 1876: _RandomAccessIterator __last, _Compare __comp) -: 1877: { -: 1878: if (__last - __first > int(_S_threshold)) -: 1879: { -: 1880: std::__insertion_sort(__first, __first + int(_S_threshold), __comp); -: 1881: std::__unguarded_insertion_sort(__first + int(_S_threshold), __last, -: 1882: __comp); -: 1883: } -: 1884: else -: 1885: std::__insertion_sort(__first, __last, __comp); -: 1886: } -: 1887: -: 1888: /// This is a helper function... -: 1889: template -: 1890: _RandomAccessIterator -: 1891: __unguarded_partition(_RandomAccessIterator __first, -: 1892: _RandomAccessIterator __last, -: 1893: _RandomAccessIterator __pivot, _Compare __comp) -: 1894: { -: 1895: while (true) -: 1896: { -: 1897: while (__comp(__first, __pivot)) -: 1898: ++__first; -: 1899: --__last; -: 1900: while (__comp(__pivot, __last)) -: 1901: --__last; -: 1902: if (!(__first < __last)) -: 1903: return __first; -: 1904: std::iter_swap(__first, __last); -: 1905: ++__first; -: 1906: } -: 1907: } -: 1908: -: 1909: /// This is a helper function... -: 1910: template -: 1911: inline _RandomAccessIterator -: 1912: __unguarded_partition_pivot(_RandomAccessIterator __first, -: 1913: _RandomAccessIterator __last, _Compare __comp) -: 1914: { -: 1915: _RandomAccessIterator __mid = __first + (__last - __first) / 2; -: 1916: std::__move_median_to_first(__first, __first + 1, __mid, __last - 1, -: 1917: __comp); -: 1918: return std::__unguarded_partition(__first + 1, __last, __first, __comp); -: 1919: } -: 1920: -: 1921: template -: 1922: inline void -: 1923: __partial_sort(_RandomAccessIterator __first, -: 1924: _RandomAccessIterator __middle, -: 1925: _RandomAccessIterator __last, -: 1926: _Compare __comp) -: 1927: { -: 1928: std::__heap_select(__first, __middle, __last, __comp); -: 1929: std::__sort_heap(__first, __middle, __comp); -: 1930: } -: 1931: -: 1932: /// This is a helper function for the sort routine. -: 1933: template -: 1934: void -: 1935: __introsort_loop(_RandomAccessIterator __first, -: 1936: _RandomAccessIterator __last, -: 1937: _Size __depth_limit, _Compare __comp) -: 1938: { -: 1939: while (__last - __first > int(_S_threshold)) -: 1940: { -: 1941: if (__depth_limit == 0) -: 1942: { -: 1943: std::__partial_sort(__first, __last, __last, __comp); -: 1944: return; -: 1945: } -: 1946: --__depth_limit; -: 1947: _RandomAccessIterator __cut = -: 1948: std::__unguarded_partition_pivot(__first, __last, __comp); -: 1949: std::__introsort_loop(__cut, __last, __depth_limit, __comp); -: 1950: __last = __cut; -: 1951: } -: 1952: } -: 1953: -: 1954: // sort -: 1955: -: 1956: template -: 1957: inline void -: 1958: __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, -: 1959: _Compare __comp) -: 1960: { -: 1961: if (__first != __last) -: 1962: { -: 1963: std::__introsort_loop(__first, __last, -: 1964: std::__lg(__last - __first) * 2, -: 1965: __comp); -: 1966: std::__final_insertion_sort(__first, __last, __comp); -: 1967: } -: 1968: } -: 1969: -: 1970: template -: 1971: void -: 1972: __introselect(_RandomAccessIterator __first, _RandomAccessIterator __nth, -: 1973: _RandomAccessIterator __last, _Size __depth_limit, -: 1974: _Compare __comp) -: 1975: { -: 1976: while (__last - __first > 3) -: 1977: { -: 1978: if (__depth_limit == 0) -: 1979: { -: 1980: std::__heap_select(__first, __nth + 1, __last, __comp); -: 1981: // Place the nth largest element in its final position. -: 1982: std::iter_swap(__first, __nth); -: 1983: return; -: 1984: } -: 1985: --__depth_limit; -: 1986: _RandomAccessIterator __cut = -: 1987: std::__unguarded_partition_pivot(__first, __last, __comp); -: 1988: if (__cut <= __nth) -: 1989: __first = __cut; -: 1990: else -: 1991: __last = __cut; -: 1992: } -: 1993: std::__insertion_sort(__first, __last, __comp); -: 1994: } -: 1995: -: 1996: // nth_element -: 1997: -: 1998: // lower_bound moved to stl_algobase.h -: 1999: -: 2000: /** -: 2001: * @brief Finds the first position in which @p __val could be inserted -: 2002: * without changing the ordering. -: 2003: * @ingroup binary_search_algorithms -: 2004: * @param __first An iterator. -: 2005: * @param __last Another iterator. -: 2006: * @param __val The search term. -: 2007: * @param __comp A functor to use for comparisons. -: 2008: * @return An iterator pointing to the first element not less -: 2009: * than @p __val, or end() if every element is less -: 2010: * than @p __val. -: 2011: * @ingroup binary_search_algorithms -: 2012: * -: 2013: * The comparison function should have the same effects on ordering as -: 2014: * the function used for the initial sort. -: 2015: */ -: 2016: template -: 2017: inline _ForwardIterator -: 2018: lower_bound(_ForwardIterator __first, _ForwardIterator __last, -: 2019: const _Tp& __val, _Compare __comp) -: 2020: { -: 2021: typedef typename iterator_traits<_ForwardIterator>::value_type -: 2022: _ValueType; -: 2023: -: 2024: // concept requirements -: 2025: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 2026: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 2027: _ValueType, _Tp>) -: 2028: __glibcxx_requires_partitioned_lower_pred(__first, __last, -: 2029: __val, __comp); -: 2030: -: 2031: return std::__lower_bound(__first, __last, __val, -: 2032: __gnu_cxx::__ops::__iter_comp_val(__comp)); -: 2033: } -: 2034: -: 2035: template -: 2036: _ForwardIterator -: 2037: __upper_bound(_ForwardIterator __first, _ForwardIterator __last, -: 2038: const _Tp& __val, _Compare __comp) -: 2039: { -: 2040: typedef typename iterator_traits<_ForwardIterator>::difference_type -: 2041: _DistanceType; -: 2042: -: 2043: _DistanceType __len = std::distance(__first, __last); -: 2044: -: 2045: while (__len > 0) -: 2046: { -: 2047: _DistanceType __half = __len >> 1; -: 2048: _ForwardIterator __middle = __first; -: 2049: std::advance(__middle, __half); -: 2050: if (__comp(__val, __middle)) -: 2051: __len = __half; -: 2052: else -: 2053: { -: 2054: __first = __middle; -: 2055: ++__first; -: 2056: __len = __len - __half - 1; -: 2057: } -: 2058: } -: 2059: return __first; -: 2060: } -: 2061: -: 2062: /** -: 2063: * @brief Finds the last position in which @p __val could be inserted -: 2064: * without changing the ordering. -: 2065: * @ingroup binary_search_algorithms -: 2066: * @param __first An iterator. -: 2067: * @param __last Another iterator. -: 2068: * @param __val The search term. -: 2069: * @return An iterator pointing to the first element greater than @p __val, -: 2070: * or end() if no elements are greater than @p __val. -: 2071: * @ingroup binary_search_algorithms -: 2072: */ -: 2073: template -: 2074: inline _ForwardIterator -: 2075: upper_bound(_ForwardIterator __first, _ForwardIterator __last, -: 2076: const _Tp& __val) -: 2077: { -: 2078: typedef typename iterator_traits<_ForwardIterator>::value_type -: 2079: _ValueType; -: 2080: -: 2081: // concept requirements -: 2082: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 2083: __glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>) -: 2084: __glibcxx_requires_partitioned_upper(__first, __last, __val); -: 2085: -: 2086: return std::__upper_bound(__first, __last, __val, -: 2087: __gnu_cxx::__ops::__val_less_iter()); -: 2088: } -: 2089: -: 2090: /** -: 2091: * @brief Finds the last position in which @p __val could be inserted -: 2092: * without changing the ordering. -: 2093: * @ingroup binary_search_algorithms -: 2094: * @param __first An iterator. -: 2095: * @param __last Another iterator. -: 2096: * @param __val The search term. -: 2097: * @param __comp A functor to use for comparisons. -: 2098: * @return An iterator pointing to the first element greater than @p __val, -: 2099: * or end() if no elements are greater than @p __val. -: 2100: * @ingroup binary_search_algorithms -: 2101: * -: 2102: * The comparison function should have the same effects on ordering as -: 2103: * the function used for the initial sort. -: 2104: */ -: 2105: template -: 2106: inline _ForwardIterator -: 2107: upper_bound(_ForwardIterator __first, _ForwardIterator __last, -: 2108: const _Tp& __val, _Compare __comp) -: 2109: { -: 2110: typedef typename iterator_traits<_ForwardIterator>::value_type -: 2111: _ValueType; -: 2112: -: 2113: // concept requirements -: 2114: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 2115: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 2116: _Tp, _ValueType>) -: 2117: __glibcxx_requires_partitioned_upper_pred(__first, __last, -: 2118: __val, __comp); -: 2119: -: 2120: return std::__upper_bound(__first, __last, __val, -: 2121: __gnu_cxx::__ops::__val_comp_iter(__comp)); -: 2122: } -: 2123: -: 2124: template -: 2126: pair<_ForwardIterator, _ForwardIterator> -: 2127: __equal_range(_ForwardIterator __first, _ForwardIterator __last, -: 2128: const _Tp& __val, -: 2129: _CompareItTp __comp_it_val, _CompareTpIt __comp_val_it) -: 2130: { -: 2131: typedef typename iterator_traits<_ForwardIterator>::difference_type -: 2132: _DistanceType; -: 2133: -: 2134: _DistanceType __len = std::distance(__first, __last); -: 2135: -: 2136: while (__len > 0) -: 2137: { -: 2138: _DistanceType __half = __len >> 1; -: 2139: _ForwardIterator __middle = __first; -: 2140: std::advance(__middle, __half); -: 2141: if (__comp_it_val(__middle, __val)) -: 2142: { -: 2143: __first = __middle; -: 2144: ++__first; -: 2145: __len = __len - __half - 1; -: 2146: } -: 2147: else if (__comp_val_it(__val, __middle)) -: 2148: __len = __half; -: 2149: else -: 2150: { -: 2151: _ForwardIterator __left -: 2152: = std::__lower_bound(__first, __middle, __val, __comp_it_val); -: 2153: std::advance(__first, __len); -: 2154: _ForwardIterator __right -: 2155: = std::__upper_bound(++__middle, __first, __val, __comp_val_it); -: 2156: return pair<_ForwardIterator, _ForwardIterator>(__left, __right); -: 2157: } -: 2158: } -: 2159: return pair<_ForwardIterator, _ForwardIterator>(__first, __first); -: 2160: } -: 2161: -: 2162: /** -: 2163: * @brief Finds the largest subrange in which @p __val could be inserted -: 2164: * at any place in it without changing the ordering. -: 2165: * @ingroup binary_search_algorithms -: 2166: * @param __first An iterator. -: 2167: * @param __last Another iterator. -: 2168: * @param __val The search term. -: 2169: * @return An pair of iterators defining the subrange. -: 2170: * @ingroup binary_search_algorithms -: 2171: * -: 2172: * This is equivalent to -: 2173: * @code -: 2174: * std::make_pair(lower_bound(__first, __last, __val), -: 2175: * upper_bound(__first, __last, __val)) -: 2176: * @endcode -: 2177: * but does not actually call those functions. -: 2178: */ -: 2179: template -: 2180: inline pair<_ForwardIterator, _ForwardIterator> -: 2181: equal_range(_ForwardIterator __first, _ForwardIterator __last, -: 2182: const _Tp& __val) -: 2183: { -: 2184: typedef typename iterator_traits<_ForwardIterator>::value_type -: 2185: _ValueType; -: 2186: -: 2187: // concept requirements -: 2188: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 2189: __glibcxx_function_requires(_LessThanOpConcept<_ValueType, _Tp>) -: 2190: __glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>) -: 2191: __glibcxx_requires_partitioned_lower(__first, __last, __val); -: 2192: __glibcxx_requires_partitioned_upper(__first, __last, __val); -: 2193: -: 2194: return std::__equal_range(__first, __last, __val, -: 2195: __gnu_cxx::__ops::__iter_less_val(), -: 2196: __gnu_cxx::__ops::__val_less_iter()); -: 2197: } -: 2198: -: 2199: /** -: 2200: * @brief Finds the largest subrange in which @p __val could be inserted -: 2201: * at any place in it without changing the ordering. -: 2202: * @param __first An iterator. -: 2203: * @param __last Another iterator. -: 2204: * @param __val The search term. -: 2205: * @param __comp A functor to use for comparisons. -: 2206: * @return An pair of iterators defining the subrange. -: 2207: * @ingroup binary_search_algorithms -: 2208: * -: 2209: * This is equivalent to -: 2210: * @code -: 2211: * std::make_pair(lower_bound(__first, __last, __val, __comp), -: 2212: * upper_bound(__first, __last, __val, __comp)) -: 2213: * @endcode -: 2214: * but does not actually call those functions. -: 2215: */ -: 2216: template -: 2217: inline pair<_ForwardIterator, _ForwardIterator> -: 2218: equal_range(_ForwardIterator __first, _ForwardIterator __last, -: 2219: const _Tp& __val, _Compare __comp) -: 2220: { -: 2221: typedef typename iterator_traits<_ForwardIterator>::value_type -: 2222: _ValueType; -: 2223: -: 2224: // concept requirements -: 2225: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 2226: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 2227: _ValueType, _Tp>) -: 2228: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 2229: _Tp, _ValueType>) -: 2230: __glibcxx_requires_partitioned_lower_pred(__first, __last, -: 2231: __val, __comp); -: 2232: __glibcxx_requires_partitioned_upper_pred(__first, __last, -: 2233: __val, __comp); -: 2234: -: 2235: return std::__equal_range(__first, __last, __val, -: 2236: __gnu_cxx::__ops::__iter_comp_val(__comp), -: 2237: __gnu_cxx::__ops::__val_comp_iter(__comp)); -: 2238: } -: 2239: -: 2240: /** -: 2241: * @brief Determines whether an element exists in a range. -: 2242: * @ingroup binary_search_algorithms -: 2243: * @param __first An iterator. -: 2244: * @param __last Another iterator. -: 2245: * @param __val The search term. -: 2246: * @return True if @p __val (or its equivalent) is in [@p -: 2247: * __first,@p __last ]. -: 2248: * -: 2249: * Note that this does not actually return an iterator to @p __val. For -: 2250: * that, use std::find or a container's specialized find member functions. -: 2251: */ -: 2252: template -: 2253: bool -: 2254: binary_search(_ForwardIterator __first, _ForwardIterator __last, -: 2255: const _Tp& __val) -: 2256: { -: 2257: typedef typename iterator_traits<_ForwardIterator>::value_type -: 2258: _ValueType; -: 2259: -: 2260: // concept requirements -: 2261: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 2262: __glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>) -: 2263: __glibcxx_requires_partitioned_lower(__first, __last, __val); -: 2264: __glibcxx_requires_partitioned_upper(__first, __last, __val); -: 2265: -: 2266: _ForwardIterator __i -: 2267: = std::__lower_bound(__first, __last, __val, -: 2268: __gnu_cxx::__ops::__iter_less_val()); -: 2269: return __i != __last && !(__val < *__i); -: 2270: } -: 2271: -: 2272: /** -: 2273: * @brief Determines whether an element exists in a range. -: 2274: * @ingroup binary_search_algorithms -: 2275: * @param __first An iterator. -: 2276: * @param __last Another iterator. -: 2277: * @param __val The search term. -: 2278: * @param __comp A functor to use for comparisons. -: 2279: * @return True if @p __val (or its equivalent) is in @p [__first,__last]. -: 2280: * -: 2281: * Note that this does not actually return an iterator to @p __val. For -: 2282: * that, use std::find or a container's specialized find member functions. -: 2283: * -: 2284: * The comparison function should have the same effects on ordering as -: 2285: * the function used for the initial sort. -: 2286: */ -: 2287: template -: 2288: bool -: 2289: binary_search(_ForwardIterator __first, _ForwardIterator __last, -: 2290: const _Tp& __val, _Compare __comp) -: 2291: { -: 2292: typedef typename iterator_traits<_ForwardIterator>::value_type -: 2293: _ValueType; -: 2294: -: 2295: // concept requirements -: 2296: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 2297: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 2298: _Tp, _ValueType>) -: 2299: __glibcxx_requires_partitioned_lower_pred(__first, __last, -: 2300: __val, __comp); -: 2301: __glibcxx_requires_partitioned_upper_pred(__first, __last, -: 2302: __val, __comp); -: 2303: -: 2304: _ForwardIterator __i -: 2305: = std::__lower_bound(__first, __last, __val, -: 2306: __gnu_cxx::__ops::__iter_comp_val(__comp)); -: 2307: return __i != __last && !bool(__comp(__val, *__i)); -: 2308: } -: 2309: -: 2310: // merge -: 2311: -: 2312: /// This is a helper function for the __merge_adaptive routines. -: 2313: template -: 2315: void -: 2316: __move_merge_adaptive(_InputIterator1 __first1, _InputIterator1 __last1, -: 2317: _InputIterator2 __first2, _InputIterator2 __last2, -: 2318: _OutputIterator __result, _Compare __comp) -: 2319: { -: 2320: while (__first1 != __last1 && __first2 != __last2) -: 2321: { -: 2322: if (__comp(__first2, __first1)) -: 2323: { -: 2324: *__result = _GLIBCXX_MOVE(*__first2); -: 2325: ++__first2; -: 2326: } -: 2327: else -: 2328: { -: 2329: *__result = _GLIBCXX_MOVE(*__first1); -: 2330: ++__first1; -: 2331: } -: 2332: ++__result; -: 2333: } -: 2334: if (__first1 != __last1) -: 2335: _GLIBCXX_MOVE3(__first1, __last1, __result); -: 2336: } -: 2337: -: 2338: /// This is a helper function for the __merge_adaptive routines. -: 2339: template -: 2341: void -: 2342: __move_merge_adaptive_backward(_BidirectionalIterator1 __first1, -: 2343: _BidirectionalIterator1 __last1, -: 2344: _BidirectionalIterator2 __first2, -: 2345: _BidirectionalIterator2 __last2, -: 2346: _BidirectionalIterator3 __result, -: 2347: _Compare __comp) -: 2348: { -: 2349: if (__first1 == __last1) -: 2350: { -: 2351: _GLIBCXX_MOVE_BACKWARD3(__first2, __last2, __result); -: 2352: return; -: 2353: } -: 2354: else if (__first2 == __last2) -: 2355: return; -: 2356: -: 2357: --__last1; -: 2358: --__last2; -: 2359: while (true) -: 2360: { -: 2361: if (__comp(__last2, __last1)) -: 2362: { -: 2363: *--__result = _GLIBCXX_MOVE(*__last1); -: 2364: if (__first1 == __last1) -: 2365: { -: 2366: _GLIBCXX_MOVE_BACKWARD3(__first2, ++__last2, __result); -: 2367: return; -: 2368: } -: 2369: --__last1; -: 2370: } -: 2371: else -: 2372: { -: 2373: *--__result = _GLIBCXX_MOVE(*__last2); -: 2374: if (__first2 == __last2) -: 2375: return; -: 2376: --__last2; -: 2377: } -: 2378: } -: 2379: } -: 2380: -: 2381: /// This is a helper function for the merge routines. -: 2382: template -: 2384: _BidirectionalIterator1 -: 2385: __rotate_adaptive(_BidirectionalIterator1 __first, -: 2386: _BidirectionalIterator1 __middle, -: 2387: _BidirectionalIterator1 __last, -: 2388: _Distance __len1, _Distance __len2, -: 2389: _BidirectionalIterator2 __buffer, -: 2390: _Distance __buffer_size) -: 2391: { -: 2392: _BidirectionalIterator2 __buffer_end; -: 2393: if (__len1 > __len2 && __len2 <= __buffer_size) -: 2394: { -: 2395: if (__len2) -: 2396: { -: 2397: __buffer_end = _GLIBCXX_MOVE3(__middle, __last, __buffer); -: 2398: _GLIBCXX_MOVE_BACKWARD3(__first, __middle, __last); -: 2399: return _GLIBCXX_MOVE3(__buffer, __buffer_end, __first); -: 2400: } -: 2401: else -: 2402: return __first; -: 2403: } -: 2404: else if (__len1 <= __buffer_size) -: 2405: { -: 2406: if (__len1) -: 2407: { -: 2408: __buffer_end = _GLIBCXX_MOVE3(__first, __middle, __buffer); -: 2409: _GLIBCXX_MOVE3(__middle, __last, __first); -: 2410: return _GLIBCXX_MOVE_BACKWARD3(__buffer, __buffer_end, __last); -: 2411: } -: 2412: else -: 2413: return __last; -: 2414: } -: 2415: else -: 2416: { -: 2417: std::rotate(__first, __middle, __last); -: 2418: std::advance(__first, std::distance(__middle, __last)); -: 2419: return __first; -: 2420: } -: 2421: } -: 2422: -: 2423: /// This is a helper function for the merge routines. -: 2424: template -: 2426: void -: 2427: __merge_adaptive(_BidirectionalIterator __first, -: 2428: _BidirectionalIterator __middle, -: 2429: _BidirectionalIterator __last, -: 2430: _Distance __len1, _Distance __len2, -: 2431: _Pointer __buffer, _Distance __buffer_size, -: 2432: _Compare __comp) -: 2433: { -: 2434: if (__len1 <= __len2 && __len1 <= __buffer_size) -: 2435: { -: 2436: _Pointer __buffer_end = _GLIBCXX_MOVE3(__first, __middle, __buffer); -: 2437: std::__move_merge_adaptive(__buffer, __buffer_end, __middle, __last, -: 2438: __first, __comp); -: 2439: } -: 2440: else if (__len2 <= __buffer_size) -: 2441: { -: 2442: _Pointer __buffer_end = _GLIBCXX_MOVE3(__middle, __last, __buffer); -: 2443: std::__move_merge_adaptive_backward(__first, __middle, __buffer, -: 2444: __buffer_end, __last, __comp); -: 2445: } -: 2446: else -: 2447: { -: 2448: _BidirectionalIterator __first_cut = __first; -: 2449: _BidirectionalIterator __second_cut = __middle; -: 2450: _Distance __len11 = 0; -: 2451: _Distance __len22 = 0; -: 2452: if (__len1 > __len2) -: 2453: { -: 2454: __len11 = __len1 / 2; -: 2455: std::advance(__first_cut, __len11); -: 2456: __second_cut -: 2457: = std::__lower_bound(__middle, __last, *__first_cut, -: 2458: __gnu_cxx::__ops::__iter_comp_val(__comp)); -: 2459: __len22 = std::distance(__middle, __second_cut); -: 2460: } -: 2461: else -: 2462: { -: 2463: __len22 = __len2 / 2; -: 2464: std::advance(__second_cut, __len22); -: 2465: __first_cut -: 2466: = std::__upper_bound(__first, __middle, *__second_cut, -: 2467: __gnu_cxx::__ops::__val_comp_iter(__comp)); -: 2468: __len11 = std::distance(__first, __first_cut); -: 2469: } -: 2470: -: 2471: _BidirectionalIterator __new_middle -: 2472: = std::__rotate_adaptive(__first_cut, __middle, __second_cut, -: 2473: __len1 - __len11, __len22, __buffer, -: 2474: __buffer_size); -: 2475: std::__merge_adaptive(__first, __first_cut, __new_middle, __len11, -: 2476: __len22, __buffer, __buffer_size, __comp); -: 2477: std::__merge_adaptive(__new_middle, __second_cut, __last, -: 2478: __len1 - __len11, -: 2479: __len2 - __len22, __buffer, -: 2480: __buffer_size, __comp); -: 2481: } -: 2482: } -: 2483: -: 2484: /// This is a helper function for the merge routines. -: 2485: template -: 2487: void -: 2488: __merge_without_buffer(_BidirectionalIterator __first, -: 2489: _BidirectionalIterator __middle, -: 2490: _BidirectionalIterator __last, -: 2491: _Distance __len1, _Distance __len2, -: 2492: _Compare __comp) -: 2493: { -: 2494: if (__len1 == 0 || __len2 == 0) -: 2495: return; -: 2496: -: 2497: if (__len1 + __len2 == 2) -: 2498: { -: 2499: if (__comp(__middle, __first)) -: 2500: std::iter_swap(__first, __middle); -: 2501: return; -: 2502: } -: 2503: -: 2504: _BidirectionalIterator __first_cut = __first; -: 2505: _BidirectionalIterator __second_cut = __middle; -: 2506: _Distance __len11 = 0; -: 2507: _Distance __len22 = 0; -: 2508: if (__len1 > __len2) -: 2509: { -: 2510: __len11 = __len1 / 2; -: 2511: std::advance(__first_cut, __len11); -: 2512: __second_cut -: 2513: = std::__lower_bound(__middle, __last, *__first_cut, -: 2514: __gnu_cxx::__ops::__iter_comp_val(__comp)); -: 2515: __len22 = std::distance(__middle, __second_cut); -: 2516: } -: 2517: else -: 2518: { -: 2519: __len22 = __len2 / 2; -: 2520: std::advance(__second_cut, __len22); -: 2521: __first_cut -: 2522: = std::__upper_bound(__first, __middle, *__second_cut, -: 2523: __gnu_cxx::__ops::__val_comp_iter(__comp)); -: 2524: __len11 = std::distance(__first, __first_cut); -: 2525: } -: 2526: -: 2527: std::rotate(__first_cut, __middle, __second_cut); -: 2528: _BidirectionalIterator __new_middle = __first_cut; -: 2529: std::advance(__new_middle, std::distance(__middle, __second_cut)); -: 2530: std::__merge_without_buffer(__first, __first_cut, __new_middle, -: 2531: __len11, __len22, __comp); -: 2532: std::__merge_without_buffer(__new_middle, __second_cut, __last, -: 2533: __len1 - __len11, __len2 - __len22, __comp); -: 2534: } -: 2535: -: 2536: template -: 2537: void -: 2538: __inplace_merge(_BidirectionalIterator __first, -: 2539: _BidirectionalIterator __middle, -: 2540: _BidirectionalIterator __last, -: 2541: _Compare __comp) -: 2542: { -: 2543: typedef typename iterator_traits<_BidirectionalIterator>::value_type -: 2544: _ValueType; -: 2545: typedef typename iterator_traits<_BidirectionalIterator>::difference_type -: 2546: _DistanceType; -: 2547: -: 2548: if (__first == __middle || __middle == __last) -: 2549: return; -: 2550: -: 2551: const _DistanceType __len1 = std::distance(__first, __middle); -: 2552: const _DistanceType __len2 = std::distance(__middle, __last); -: 2553: -: 2554: typedef _Temporary_buffer<_BidirectionalIterator, _ValueType> _TmpBuf; -: 2555: _TmpBuf __buf(__first, __last); -: 2556: -: 2557: if (__buf.begin() == 0) -: 2558: std::__merge_without_buffer -: 2559: (__first, __middle, __last, __len1, __len2, __comp); -: 2560: else -: 2561: std::__merge_adaptive -: 2562: (__first, __middle, __last, __len1, __len2, __buf.begin(), -: 2563: _DistanceType(__buf.size()), __comp); -: 2564: } -: 2565: -: 2566: /** -: 2567: * @brief Merges two sorted ranges in place. -: 2568: * @ingroup sorting_algorithms -: 2569: * @param __first An iterator. -: 2570: * @param __middle Another iterator. -: 2571: * @param __last Another iterator. -: 2572: * @return Nothing. -: 2573: * -: 2574: * Merges two sorted and consecutive ranges, [__first,__middle) and -: 2575: * [__middle,__last), and puts the result in [__first,__last). The -: 2576: * output will be sorted. The sort is @e stable, that is, for -: 2577: * equivalent elements in the two ranges, elements from the first -: 2578: * range will always come before elements from the second. -: 2579: * -: 2580: * If enough additional memory is available, this takes (__last-__first)-1 -: 2581: * comparisons. Otherwise an NlogN algorithm is used, where N is -: 2582: * distance(__first,__last). -: 2583: */ -: 2584: template -: 2585: inline void -: 2586: inplace_merge(_BidirectionalIterator __first, -: 2587: _BidirectionalIterator __middle, -: 2588: _BidirectionalIterator __last) -: 2589: { -: 2590: // concept requirements -: 2591: __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept< -: 2592: _BidirectionalIterator>) -: 2593: __glibcxx_function_requires(_LessThanComparableConcept< -: 2594: typename iterator_traits<_BidirectionalIterator>::value_type>) -: 2595: __glibcxx_requires_sorted(__first, __middle); -: 2596: __glibcxx_requires_sorted(__middle, __last); -: 2597: -: 2598: std::__inplace_merge(__first, __middle, __last, -: 2599: __gnu_cxx::__ops::__iter_less_iter()); -: 2600: } -: 2601: -: 2602: /** -: 2603: * @brief Merges two sorted ranges in place. -: 2604: * @ingroup sorting_algorithms -: 2605: * @param __first An iterator. -: 2606: * @param __middle Another iterator. -: 2607: * @param __last Another iterator. -: 2608: * @param __comp A functor to use for comparisons. -: 2609: * @return Nothing. -: 2610: * -: 2611: * Merges two sorted and consecutive ranges, [__first,__middle) and -: 2612: * [middle,last), and puts the result in [__first,__last). The output will -: 2613: * be sorted. The sort is @e stable, that is, for equivalent -: 2614: * elements in the two ranges, elements from the first range will always -: 2615: * come before elements from the second. -: 2616: * -: 2617: * If enough additional memory is available, this takes (__last-__first)-1 -: 2618: * comparisons. Otherwise an NlogN algorithm is used, where N is -: 2619: * distance(__first,__last). -: 2620: * -: 2621: * The comparison function should have the same effects on ordering as -: 2622: * the function used for the initial sort. -: 2623: */ -: 2624: template -: 2625: inline void -: 2626: inplace_merge(_BidirectionalIterator __first, -: 2627: _BidirectionalIterator __middle, -: 2628: _BidirectionalIterator __last, -: 2629: _Compare __comp) -: 2630: { -: 2631: // concept requirements -: 2632: __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept< -: 2633: _BidirectionalIterator>) -: 2634: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 2635: typename iterator_traits<_BidirectionalIterator>::value_type, -: 2636: typename iterator_traits<_BidirectionalIterator>::value_type>) -: 2637: __glibcxx_requires_sorted_pred(__first, __middle, __comp); -: 2638: __glibcxx_requires_sorted_pred(__middle, __last, __comp); -: 2639: -: 2640: std::__inplace_merge(__first, __middle, __last, -: 2641: __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 2642: } -: 2643: -: 2644: -: 2645: /// This is a helper function for the __merge_sort_loop routines. -: 2646: template -: 2648: _OutputIterator -: 2649: __move_merge(_InputIterator __first1, _InputIterator __last1, -: 2650: _InputIterator __first2, _InputIterator __last2, -: 2651: _OutputIterator __result, _Compare __comp) -: 2652: { -: 2653: while (__first1 != __last1 && __first2 != __last2) -: 2654: { -: 2655: if (__comp(__first2, __first1)) -: 2656: { -: 2657: *__result = _GLIBCXX_MOVE(*__first2); -: 2658: ++__first2; -: 2659: } -: 2660: else -: 2661: { -: 2662: *__result = _GLIBCXX_MOVE(*__first1); -: 2663: ++__first1; -: 2664: } -: 2665: ++__result; -: 2666: } -: 2667: return _GLIBCXX_MOVE3(__first2, __last2, -: 2668: _GLIBCXX_MOVE3(__first1, __last1, -: 2669: __result)); -: 2670: } -: 2671: -: 2672: template -: 2674: void -: 2675: __merge_sort_loop(_RandomAccessIterator1 __first, -: 2676: _RandomAccessIterator1 __last, -: 2677: _RandomAccessIterator2 __result, _Distance __step_size, -: 2678: _Compare __comp) -: 2679: { -: 2680: const _Distance __two_step = 2 * __step_size; -: 2681: -: 2682: while (__last - __first >= __two_step) -: 2683: { -: 2684: __result = std::__move_merge(__first, __first + __step_size, -: 2685: __first + __step_size, -: 2686: __first + __two_step, -: 2687: __result, __comp); -: 2688: __first += __two_step; -: 2689: } -: 2690: __step_size = std::min(_Distance(__last - __first), __step_size); -: 2691: -: 2692: std::__move_merge(__first, __first + __step_size, -: 2693: __first + __step_size, __last, __result, __comp); -: 2694: } -: 2695: -: 2696: template -: 2698: void -: 2699: __chunk_insertion_sort(_RandomAccessIterator __first, -: 2700: _RandomAccessIterator __last, -: 2701: _Distance __chunk_size, _Compare __comp) -: 2702: { -: 2703: while (__last - __first >= __chunk_size) -: 2704: { -: 2705: std::__insertion_sort(__first, __first + __chunk_size, __comp); -: 2706: __first += __chunk_size; -: 2707: } -: 2708: std::__insertion_sort(__first, __last, __comp); -: 2709: } -: 2710: -: 2711: enum { _S_chunk_size = 7 }; -: 2712: -: 2713: template -: 2714: void -: 2715: __merge_sort_with_buffer(_RandomAccessIterator __first, -: 2716: _RandomAccessIterator __last, -: 2717: _Pointer __buffer, _Compare __comp) -: 2718: { -: 2719: typedef typename iterator_traits<_RandomAccessIterator>::difference_type -: 2720: _Distance; -: 2721: -: 2722: const _Distance __len = __last - __first; -: 2723: const _Pointer __buffer_last = __buffer + __len; -: 2724: -: 2725: _Distance __step_size = _S_chunk_size; -: 2726: std::__chunk_insertion_sort(__first, __last, __step_size, __comp); -: 2727: -: 2728: while (__step_size < __len) -: 2729: { -: 2730: std::__merge_sort_loop(__first, __last, __buffer, -: 2731: __step_size, __comp); -: 2732: __step_size *= 2; -: 2733: std::__merge_sort_loop(__buffer, __buffer_last, __first, -: 2734: __step_size, __comp); -: 2735: __step_size *= 2; -: 2736: } -: 2737: } -: 2738: -: 2739: template -: 2741: void -: 2742: __stable_sort_adaptive(_RandomAccessIterator __first, -: 2743: _RandomAccessIterator __last, -: 2744: _Pointer __buffer, _Distance __buffer_size, -: 2745: _Compare __comp) -: 2746: { -: 2747: const _Distance __len = (__last - __first + 1) / 2; -: 2748: const _RandomAccessIterator __middle = __first + __len; -: 2749: if (__len > __buffer_size) -: 2750: { -: 2751: std::__stable_sort_adaptive(__first, __middle, __buffer, -: 2752: __buffer_size, __comp); -: 2753: std::__stable_sort_adaptive(__middle, __last, __buffer, -: 2754: __buffer_size, __comp); -: 2755: } -: 2756: else -: 2757: { -: 2758: std::__merge_sort_with_buffer(__first, __middle, __buffer, __comp); -: 2759: std::__merge_sort_with_buffer(__middle, __last, __buffer, __comp); -: 2760: } -: 2761: std::__merge_adaptive(__first, __middle, __last, -: 2762: _Distance(__middle - __first), -: 2763: _Distance(__last - __middle), -: 2764: __buffer, __buffer_size, -: 2765: __comp); -: 2766: } -: 2767: -: 2768: /// This is a helper function for the stable sorting routines. -: 2769: template -: 2770: void -: 2771: __inplace_stable_sort(_RandomAccessIterator __first, -: 2772: _RandomAccessIterator __last, _Compare __comp) -: 2773: { -: 2774: if (__last - __first < 15) -: 2775: { -: 2776: std::__insertion_sort(__first, __last, __comp); -: 2777: return; -: 2778: } -: 2779: _RandomAccessIterator __middle = __first + (__last - __first) / 2; -: 2780: std::__inplace_stable_sort(__first, __middle, __comp); -: 2781: std::__inplace_stable_sort(__middle, __last, __comp); -: 2782: std::__merge_without_buffer(__first, __middle, __last, -: 2783: __middle - __first, -: 2784: __last - __middle, -: 2785: __comp); -: 2786: } -: 2787: -: 2788: // stable_sort -: 2789: -: 2790: // Set algorithms: includes, set_union, set_intersection, set_difference, -: 2791: // set_symmetric_difference. All of these algorithms have the precondition -: 2792: // that their input ranges are sorted and the postcondition that their output -: 2793: // ranges are sorted. -: 2794: -: 2795: template -: 2797: bool -: 2798: __includes(_InputIterator1 __first1, _InputIterator1 __last1, -: 2799: _InputIterator2 __first2, _InputIterator2 __last2, -: 2800: _Compare __comp) -: 2801: { -: 2802: while (__first1 != __last1 && __first2 != __last2) -: 2803: if (__comp(__first2, __first1)) -: 2804: return false; -: 2805: else if (__comp(__first1, __first2)) -: 2806: ++__first1; -: 2807: else -: 2808: ++__first1, ++__first2; -: 2809: -: 2810: return __first2 == __last2; -: 2811: } -: 2812: -: 2813: /** -: 2814: * @brief Determines whether all elements of a sequence exists in a range. -: 2815: * @param __first1 Start of search range. -: 2816: * @param __last1 End of search range. -: 2817: * @param __first2 Start of sequence -: 2818: * @param __last2 End of sequence. -: 2819: * @return True if each element in [__first2,__last2) is contained in order -: 2820: * within [__first1,__last1). False otherwise. -: 2821: * @ingroup set_algorithms -: 2822: * -: 2823: * This operation expects both [__first1,__last1) and -: 2824: * [__first2,__last2) to be sorted. Searches for the presence of -: 2825: * each element in [__first2,__last2) within [__first1,__last1). -: 2826: * The iterators over each range only move forward, so this is a -: 2827: * linear algorithm. If an element in [__first2,__last2) is not -: 2828: * found before the search iterator reaches @p __last2, false is -: 2829: * returned. -: 2830: */ -: 2831: template -: 2832: inline bool -: 2833: includes(_InputIterator1 __first1, _InputIterator1 __last1, -: 2834: _InputIterator2 __first2, _InputIterator2 __last2) -: 2835: { -: 2836: // concept requirements -: 2837: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) -: 2838: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) -: 2839: __glibcxx_function_requires(_LessThanOpConcept< -: 2840: typename iterator_traits<_InputIterator1>::value_type, -: 2841: typename iterator_traits<_InputIterator2>::value_type>) -: 2842: __glibcxx_function_requires(_LessThanOpConcept< -: 2843: typename iterator_traits<_InputIterator2>::value_type, -: 2844: typename iterator_traits<_InputIterator1>::value_type>) -: 2845: __glibcxx_requires_sorted_set(__first1, __last1, __first2); -: 2846: __glibcxx_requires_sorted_set(__first2, __last2, __first1); -: 2847: -: 2848: return std::__includes(__first1, __last1, __first2, __last2, -: 2849: __gnu_cxx::__ops::__iter_less_iter()); -: 2850: } -: 2851: -: 2852: /** -: 2853: * @brief Determines whether all elements of a sequence exists in a range -: 2854: * using comparison. -: 2855: * @ingroup set_algorithms -: 2856: * @param __first1 Start of search range. -: 2857: * @param __last1 End of search range. -: 2858: * @param __first2 Start of sequence -: 2859: * @param __last2 End of sequence. -: 2860: * @param __comp Comparison function to use. -: 2861: * @return True if each element in [__first2,__last2) is contained -: 2862: * in order within [__first1,__last1) according to comp. False -: 2863: * otherwise. @ingroup set_algorithms -: 2864: * -: 2865: * This operation expects both [__first1,__last1) and -: 2866: * [__first2,__last2) to be sorted. Searches for the presence of -: 2867: * each element in [__first2,__last2) within [__first1,__last1), -: 2868: * using comp to decide. The iterators over each range only move -: 2869: * forward, so this is a linear algorithm. If an element in -: 2870: * [__first2,__last2) is not found before the search iterator -: 2871: * reaches @p __last2, false is returned. -: 2872: */ -: 2873: template -: 2875: inline bool -: 2876: includes(_InputIterator1 __first1, _InputIterator1 __last1, -: 2877: _InputIterator2 __first2, _InputIterator2 __last2, -: 2878: _Compare __comp) -: 2879: { -: 2880: // concept requirements -: 2881: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) -: 2882: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) -: 2883: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 2884: typename iterator_traits<_InputIterator1>::value_type, -: 2885: typename iterator_traits<_InputIterator2>::value_type>) -: 2886: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 2887: typename iterator_traits<_InputIterator2>::value_type, -: 2888: typename iterator_traits<_InputIterator1>::value_type>) -: 2889: __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); -: 2890: __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); -: 2891: -: 2892: return std::__includes(__first1, __last1, __first2, __last2, -: 2893: __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 2894: } -: 2895: -: 2896: // nth_element -: 2897: // merge -: 2898: // set_difference -: 2899: // set_intersection -: 2900: // set_union -: 2901: // stable_sort -: 2902: // set_symmetric_difference -: 2903: // min_element -: 2904: // max_element -: 2905: -: 2906: template -: 2907: bool -: 2908: __next_permutation(_BidirectionalIterator __first, -: 2909: _BidirectionalIterator __last, _Compare __comp) -: 2910: { -: 2911: if (__first == __last) -: 2912: return false; -: 2913: _BidirectionalIterator __i = __first; -: 2914: ++__i; -: 2915: if (__i == __last) -: 2916: return false; -: 2917: __i = __last; -: 2918: --__i; -: 2919: -: 2920: for(;;) -: 2921: { -: 2922: _BidirectionalIterator __ii = __i; -: 2923: --__i; -: 2924: if (__comp(__i, __ii)) -: 2925: { -: 2926: _BidirectionalIterator __j = __last; -: 2927: while (!__comp(__i, --__j)) -: 2928: {} -: 2929: std::iter_swap(__i, __j); -: 2930: std::__reverse(__ii, __last, -: 2931: std::__iterator_category(__first)); -: 2932: return true; -: 2933: } -: 2934: if (__i == __first) -: 2935: { -: 2936: std::__reverse(__first, __last, -: 2937: std::__iterator_category(__first)); -: 2938: return false; -: 2939: } -: 2940: } -: 2941: } -: 2942: -: 2943: /** -: 2944: * @brief Permute range into the next @e dictionary ordering. -: 2945: * @ingroup sorting_algorithms -: 2946: * @param __first Start of range. -: 2947: * @param __last End of range. -: 2948: * @return False if wrapped to first permutation, true otherwise. -: 2949: * -: 2950: * Treats all permutations of the range as a set of @e dictionary sorted -: 2951: * sequences. Permutes the current sequence into the next one of this set. -: 2952: * Returns true if there are more sequences to generate. If the sequence -: 2953: * is the largest of the set, the smallest is generated and false returned. -: 2954: */ -: 2955: template -: 2956: inline bool -: 2957: next_permutation(_BidirectionalIterator __first, -: 2958: _BidirectionalIterator __last) -: 2959: { -: 2960: // concept requirements -: 2961: __glibcxx_function_requires(_BidirectionalIteratorConcept< -: 2962: _BidirectionalIterator>) -: 2963: __glibcxx_function_requires(_LessThanComparableConcept< -: 2964: typename iterator_traits<_BidirectionalIterator>::value_type>) -: 2965: __glibcxx_requires_valid_range(__first, __last); -: 2966: -: 2967: return std::__next_permutation -: 2968: (__first, __last, __gnu_cxx::__ops::__iter_less_iter()); -: 2969: } -: 2970: -: 2971: /** -: 2972: * @brief Permute range into the next @e dictionary ordering using -: 2973: * comparison functor. -: 2974: * @ingroup sorting_algorithms -: 2975: * @param __first Start of range. -: 2976: * @param __last End of range. -: 2977: * @param __comp A comparison functor. -: 2978: * @return False if wrapped to first permutation, true otherwise. -: 2979: * -: 2980: * Treats all permutations of the range [__first,__last) as a set of -: 2981: * @e dictionary sorted sequences ordered by @p __comp. Permutes the current -: 2982: * sequence into the next one of this set. Returns true if there are more -: 2983: * sequences to generate. If the sequence is the largest of the set, the -: 2984: * smallest is generated and false returned. -: 2985: */ -: 2986: template -: 2987: inline bool -: 2988: next_permutation(_BidirectionalIterator __first, -: 2989: _BidirectionalIterator __last, _Compare __comp) -: 2990: { -: 2991: // concept requirements -: 2992: __glibcxx_function_requires(_BidirectionalIteratorConcept< -: 2993: _BidirectionalIterator>) -: 2994: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 2995: typename iterator_traits<_BidirectionalIterator>::value_type, -: 2996: typename iterator_traits<_BidirectionalIterator>::value_type>) -: 2997: __glibcxx_requires_valid_range(__first, __last); -: 2998: -: 2999: return std::__next_permutation -: 3000: (__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 3001: } -: 3002: -: 3003: template -: 3004: bool -: 3005: __prev_permutation(_BidirectionalIterator __first, -: 3006: _BidirectionalIterator __last, _Compare __comp) -: 3007: { -: 3008: if (__first == __last) -: 3009: return false; -: 3010: _BidirectionalIterator __i = __first; -: 3011: ++__i; -: 3012: if (__i == __last) -: 3013: return false; -: 3014: __i = __last; -: 3015: --__i; -: 3016: -: 3017: for(;;) -: 3018: { -: 3019: _BidirectionalIterator __ii = __i; -: 3020: --__i; -: 3021: if (__comp(__ii, __i)) -: 3022: { -: 3023: _BidirectionalIterator __j = __last; -: 3024: while (!__comp(--__j, __i)) -: 3025: {} -: 3026: std::iter_swap(__i, __j); -: 3027: std::__reverse(__ii, __last, -: 3028: std::__iterator_category(__first)); -: 3029: return true; -: 3030: } -: 3031: if (__i == __first) -: 3032: { -: 3033: std::__reverse(__first, __last, -: 3034: std::__iterator_category(__first)); -: 3035: return false; -: 3036: } -: 3037: } -: 3038: } -: 3039: -: 3040: /** -: 3041: * @brief Permute range into the previous @e dictionary ordering. -: 3042: * @ingroup sorting_algorithms -: 3043: * @param __first Start of range. -: 3044: * @param __last End of range. -: 3045: * @return False if wrapped to last permutation, true otherwise. -: 3046: * -: 3047: * Treats all permutations of the range as a set of @e dictionary sorted -: 3048: * sequences. Permutes the current sequence into the previous one of this -: 3049: * set. Returns true if there are more sequences to generate. If the -: 3050: * sequence is the smallest of the set, the largest is generated and false -: 3051: * returned. -: 3052: */ -: 3053: template -: 3054: inline bool -: 3055: prev_permutation(_BidirectionalIterator __first, -: 3056: _BidirectionalIterator __last) -: 3057: { -: 3058: // concept requirements -: 3059: __glibcxx_function_requires(_BidirectionalIteratorConcept< -: 3060: _BidirectionalIterator>) -: 3061: __glibcxx_function_requires(_LessThanComparableConcept< -: 3062: typename iterator_traits<_BidirectionalIterator>::value_type>) -: 3063: __glibcxx_requires_valid_range(__first, __last); -: 3064: -: 3065: return std::__prev_permutation(__first, __last, -: 3066: __gnu_cxx::__ops::__iter_less_iter()); -: 3067: } -: 3068: -: 3069: /** -: 3070: * @brief Permute range into the previous @e dictionary ordering using -: 3071: * comparison functor. -: 3072: * @ingroup sorting_algorithms -: 3073: * @param __first Start of range. -: 3074: * @param __last End of range. -: 3075: * @param __comp A comparison functor. -: 3076: * @return False if wrapped to last permutation, true otherwise. -: 3077: * -: 3078: * Treats all permutations of the range [__first,__last) as a set of -: 3079: * @e dictionary sorted sequences ordered by @p __comp. Permutes the current -: 3080: * sequence into the previous one of this set. Returns true if there are -: 3081: * more sequences to generate. If the sequence is the smallest of the set, -: 3082: * the largest is generated and false returned. -: 3083: */ -: 3084: template -: 3085: inline bool -: 3086: prev_permutation(_BidirectionalIterator __first, -: 3087: _BidirectionalIterator __last, _Compare __comp) -: 3088: { -: 3089: // concept requirements -: 3090: __glibcxx_function_requires(_BidirectionalIteratorConcept< -: 3091: _BidirectionalIterator>) -: 3092: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 3093: typename iterator_traits<_BidirectionalIterator>::value_type, -: 3094: typename iterator_traits<_BidirectionalIterator>::value_type>) -: 3095: __glibcxx_requires_valid_range(__first, __last); -: 3096: -: 3097: return std::__prev_permutation(__first, __last, -: 3098: __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 3099: } -: 3100: -: 3101: // replace -: 3102: // replace_if -: 3103: -: 3104: template -: 3106: _OutputIterator -: 3107: __replace_copy_if(_InputIterator __first, _InputIterator __last, -: 3108: _OutputIterator __result, -: 3109: _Predicate __pred, const _Tp& __new_value) -: 3110: { -: 3111: for (; __first != __last; ++__first, ++__result) -: 3112: if (__pred(__first)) -: 3113: *__result = __new_value; -: 3114: else -: 3115: *__result = *__first; -: 3116: return __result; -: 3117: } -: 3118: -: 3119: /** -: 3120: * @brief Copy a sequence, replacing each element of one value with another -: 3121: * value. -: 3122: * @param __first An input iterator. -: 3123: * @param __last An input iterator. -: 3124: * @param __result An output iterator. -: 3125: * @param __old_value The value to be replaced. -: 3126: * @param __new_value The replacement value. -: 3127: * @return The end of the output sequence, @p result+(last-first). -: 3128: * -: 3129: * Copies each element in the input range @p [__first,__last) to the -: 3130: * output range @p [__result,__result+(__last-__first)) replacing elements -: 3131: * equal to @p __old_value with @p __new_value. -: 3132: */ -: 3133: template -: 3134: inline _OutputIterator -: 3135: replace_copy(_InputIterator __first, _InputIterator __last, -: 3136: _OutputIterator __result, -: 3137: const _Tp& __old_value, const _Tp& __new_value) -: 3138: { -: 3139: // concept requirements -: 3140: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 3141: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 3142: typename iterator_traits<_InputIterator>::value_type>) -: 3143: __glibcxx_function_requires(_EqualOpConcept< -: 3144: typename iterator_traits<_InputIterator>::value_type, _Tp>) -: 3145: __glibcxx_requires_valid_range(__first, __last); -: 3146: -: 3147: return std::__replace_copy_if(__first, __last, __result, -: 3148: __gnu_cxx::__ops::__iter_equals_val(__old_value), -: 3149: __new_value); -: 3150: } -: 3151: -: 3152: /** -: 3153: * @brief Copy a sequence, replacing each value for which a predicate -: 3154: * returns true with another value. -: 3155: * @ingroup mutating_algorithms -: 3156: * @param __first An input iterator. -: 3157: * @param __last An input iterator. -: 3158: * @param __result An output iterator. -: 3159: * @param __pred A predicate. -: 3160: * @param __new_value The replacement value. -: 3161: * @return The end of the output sequence, @p __result+(__last-__first). -: 3162: * -: 3163: * Copies each element in the range @p [__first,__last) to the range -: 3164: * @p [__result,__result+(__last-__first)) replacing elements for which -: 3165: * @p __pred returns true with @p __new_value. -: 3166: */ -: 3167: template -: 3169: inline _OutputIterator -: 3170: replace_copy_if(_InputIterator __first, _InputIterator __last, -: 3171: _OutputIterator __result, -: 3172: _Predicate __pred, const _Tp& __new_value) -: 3173: { -: 3174: // concept requirements -: 3175: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 3176: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 3177: typename iterator_traits<_InputIterator>::value_type>) -: 3178: __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, -: 3179: typename iterator_traits<_InputIterator>::value_type>) -: 3180: __glibcxx_requires_valid_range(__first, __last); -: 3181: -: 3182: return std::__replace_copy_if(__first, __last, __result, -: 3183: __gnu_cxx::__ops::__pred_iter(__pred), -: 3184: __new_value); -: 3185: } -: 3186: -: 3187: template -: 3188: typename iterator_traits<_InputIterator>::difference_type function _ZSt10__count_ifIN9__gnu_cxx17__normal_iteratorIPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS7_SaIS7_EEEENS0_5__ops16_Iter_equals_valIS8_EEENSt15iterator_traitsIT_E15difference_typeESI_SI_T0_ called 0 returned 0% blocks executed 0% function _ZSt10__count_ifIN9__gnu_cxx17__normal_iteratorIPK6bulletSt6vectorIS2_SaIS2_EEEENS0_5__ops10_Iter_predIZN41power_stop_bullets_actually_stops_bullets11test_methodEvEUlRKT_E0_EEENSt15iterator_traitsISC_E15difference_typeESC_SC_T0_ called 1 returned 100% blocks executed 89% function _ZSt10__count_ifIN9__gnu_cxx17__normal_iteratorIPK6bulletSt6vectorIS2_SaIS2_EEEENS0_5__ops10_Iter_predIZN41power_stop_bullets_actually_stops_bullets11test_methodEvEUlRKT_E_EEENSt15iterator_traitsISC_E15difference_typeESC_SC_T0_ called 1 returned 100% blocks executed 100% 2: 3189: __count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) -: 3190: { 2: 3191: typename iterator_traits<_InputIterator>::difference_type __n = 0; 10: 3192: for (; __first != __last; ++__first) call 0 never executed branch 1 never executed branch 2 never executed call 3 never executed call 4 returned 100% branch 5 taken 67% (fallthrough) branch 6 taken 33% call 7 returned 100% call 8 returned 100% branch 9 taken 67% (fallthrough) branch 10 taken 33% call 11 returned 100% 4: 3193: if (__pred(__first)) call 0 never executed branch 1 never executed branch 2 never executed call 3 returned 100% branch 4 taken 0% (fallthrough) branch 5 taken 100% call 6 returned 100% branch 7 taken 100% (fallthrough) branch 8 taken 0% 2: 3194: ++__n; call 0 never executed call 1 never executed call 2 returned 100% 2: 3195: return __n; -: 3196: } -: 3197: -: 3198:#if __cplusplus >= 201103L -: 3199: /** -: 3200: * @brief Determines whether the elements of a sequence are sorted. -: 3201: * @ingroup sorting_algorithms -: 3202: * @param __first An iterator. -: 3203: * @param __last Another iterator. -: 3204: * @return True if the elements are sorted, false otherwise. -: 3205: */ -: 3206: template -: 3207: inline bool -: 3208: is_sorted(_ForwardIterator __first, _ForwardIterator __last) -: 3209: { return std::is_sorted_until(__first, __last) == __last; } -: 3210: -: 3211: /** -: 3212: * @brief Determines whether the elements of a sequence are sorted -: 3213: * according to a comparison functor. -: 3214: * @ingroup sorting_algorithms -: 3215: * @param __first An iterator. -: 3216: * @param __last Another iterator. -: 3217: * @param __comp A comparison functor. -: 3218: * @return True if the elements are sorted, false otherwise. -: 3219: */ -: 3220: template -: 3221: inline bool -: 3222: is_sorted(_ForwardIterator __first, _ForwardIterator __last, -: 3223: _Compare __comp) -: 3224: { return std::is_sorted_until(__first, __last, __comp) == __last; } -: 3225: -: 3226: template -: 3227: _ForwardIterator -: 3228: __is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, -: 3229: _Compare __comp) -: 3230: { -: 3231: if (__first == __last) -: 3232: return __last; -: 3233: -: 3234: _ForwardIterator __next = __first; -: 3235: for (++__next; __next != __last; __first = __next, ++__next) -: 3236: if (__comp(__next, __first)) -: 3237: return __next; -: 3238: return __next; -: 3239: } -: 3240: -: 3241: /** -: 3242: * @brief Determines the end of a sorted sequence. -: 3243: * @ingroup sorting_algorithms -: 3244: * @param __first An iterator. -: 3245: * @param __last Another iterator. -: 3246: * @return An iterator pointing to the last iterator i in [__first, __last) -: 3247: * for which the range [__first, i) is sorted. -: 3248: */ -: 3249: template -: 3250: inline _ForwardIterator -: 3251: is_sorted_until(_ForwardIterator __first, _ForwardIterator __last) -: 3252: { -: 3253: // concept requirements -: 3254: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 3255: __glibcxx_function_requires(_LessThanComparableConcept< -: 3256: typename iterator_traits<_ForwardIterator>::value_type>) -: 3257: __glibcxx_requires_valid_range(__first, __last); -: 3258: -: 3259: return std::__is_sorted_until(__first, __last, -: 3260: __gnu_cxx::__ops::__iter_less_iter()); -: 3261: } -: 3262: -: 3263: /** -: 3264: * @brief Determines the end of a sorted sequence using comparison functor. -: 3265: * @ingroup sorting_algorithms -: 3266: * @param __first An iterator. -: 3267: * @param __last Another iterator. -: 3268: * @param __comp A comparison functor. -: 3269: * @return An iterator pointing to the last iterator i in [__first, __last) -: 3270: * for which the range [__first, i) is sorted. -: 3271: */ -: 3272: template -: 3273: inline _ForwardIterator -: 3274: is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, -: 3275: _Compare __comp) -: 3276: { -: 3277: // concept requirements -: 3278: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 3279: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 3280: typename iterator_traits<_ForwardIterator>::value_type, -: 3281: typename iterator_traits<_ForwardIterator>::value_type>) -: 3282: __glibcxx_requires_valid_range(__first, __last); -: 3283: -: 3284: return std::__is_sorted_until(__first, __last, -: 3285: __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 3286: } -: 3287: -: 3288: /** -: 3289: * @brief Determines min and max at once as an ordered pair. -: 3290: * @ingroup sorting_algorithms -: 3291: * @param __a A thing of arbitrary type. -: 3292: * @param __b Another thing of arbitrary type. -: 3293: * @return A pair(__b, __a) if __b is smaller than __a, pair(__a, -: 3294: * __b) otherwise. -: 3295: */ -: 3296: template -: 3297: _GLIBCXX14_CONSTEXPR -: 3298: inline pair -: 3299: minmax(const _Tp& __a, const _Tp& __b) -: 3300: { -: 3301: // concept requirements -: 3302: __glibcxx_function_requires(_LessThanComparableConcept<_Tp>) -: 3303: -: 3304: return __b < __a ? pair(__b, __a) -: 3305: : pair(__a, __b); -: 3306: } -: 3307: -: 3308: /** -: 3309: * @brief Determines min and max at once as an ordered pair. -: 3310: * @ingroup sorting_algorithms -: 3311: * @param __a A thing of arbitrary type. -: 3312: * @param __b Another thing of arbitrary type. -: 3313: * @param __comp A @link comparison_functors comparison functor @endlink. -: 3314: * @return A pair(__b, __a) if __b is smaller than __a, pair(__a, -: 3315: * __b) otherwise. -: 3316: */ -: 3317: template -: 3318: _GLIBCXX14_CONSTEXPR -: 3319: inline pair -: 3320: minmax(const _Tp& __a, const _Tp& __b, _Compare __comp) -: 3321: { -: 3322: return __comp(__b, __a) ? pair(__b, __a) -: 3323: : pair(__a, __b); -: 3324: } -: 3325: -: 3326: template -: 3327: _GLIBCXX14_CONSTEXPR -: 3328: pair<_ForwardIterator, _ForwardIterator> -: 3329: __minmax_element(_ForwardIterator __first, _ForwardIterator __last, -: 3330: _Compare __comp) -: 3331: { -: 3332: _ForwardIterator __next = __first; -: 3333: if (__first == __last -: 3334: || ++__next == __last) -: 3335: return std::make_pair(__first, __first); -: 3336: -: 3337: _ForwardIterator __min{}, __max{}; -: 3338: if (__comp(__next, __first)) -: 3339: { -: 3340: __min = __next; -: 3341: __max = __first; -: 3342: } -: 3343: else -: 3344: { -: 3345: __min = __first; -: 3346: __max = __next; -: 3347: } -: 3348: -: 3349: __first = __next; -: 3350: ++__first; -: 3351: -: 3352: while (__first != __last) -: 3353: { -: 3354: __next = __first; -: 3355: if (++__next == __last) -: 3356: { -: 3357: if (__comp(__first, __min)) -: 3358: __min = __first; -: 3359: else if (!__comp(__first, __max)) -: 3360: __max = __first; -: 3361: break; -: 3362: } -: 3363: -: 3364: if (__comp(__next, __first)) -: 3365: { -: 3366: if (__comp(__next, __min)) -: 3367: __min = __next; -: 3368: if (!__comp(__first, __max)) -: 3369: __max = __first; -: 3370: } -: 3371: else -: 3372: { -: 3373: if (__comp(__first, __min)) -: 3374: __min = __first; -: 3375: if (!__comp(__next, __max)) -: 3376: __max = __next; -: 3377: } -: 3378: -: 3379: __first = __next; -: 3380: ++__first; -: 3381: } -: 3382: -: 3383: return std::make_pair(__min, __max); -: 3384: } -: 3385: -: 3386: /** -: 3387: * @brief Return a pair of iterators pointing to the minimum and maximum -: 3388: * elements in a range. -: 3389: * @ingroup sorting_algorithms -: 3390: * @param __first Start of range. -: 3391: * @param __last End of range. -: 3392: * @return make_pair(m, M), where m is the first iterator i in -: 3393: * [__first, __last) such that no other element in the range is -: 3394: * smaller, and where M is the last iterator i in [__first, __last) -: 3395: * such that no other element in the range is larger. -: 3396: */ -: 3397: template -: 3398: _GLIBCXX14_CONSTEXPR -: 3399: inline pair<_ForwardIterator, _ForwardIterator> -: 3400: minmax_element(_ForwardIterator __first, _ForwardIterator __last) -: 3401: { -: 3402: // concept requirements -: 3403: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 3404: __glibcxx_function_requires(_LessThanComparableConcept< -: 3405: typename iterator_traits<_ForwardIterator>::value_type>) -: 3406: __glibcxx_requires_valid_range(__first, __last); -: 3407: -: 3408: return std::__minmax_element(__first, __last, -: 3409: __gnu_cxx::__ops::__iter_less_iter()); -: 3410: } -: 3411: -: 3412: /** -: 3413: * @brief Return a pair of iterators pointing to the minimum and maximum -: 3414: * elements in a range. -: 3415: * @ingroup sorting_algorithms -: 3416: * @param __first Start of range. -: 3417: * @param __last End of range. -: 3418: * @param __comp Comparison functor. -: 3419: * @return make_pair(m, M), where m is the first iterator i in -: 3420: * [__first, __last) such that no other element in the range is -: 3421: * smaller, and where M is the last iterator i in [__first, __last) -: 3422: * such that no other element in the range is larger. -: 3423: */ -: 3424: template -: 3425: _GLIBCXX14_CONSTEXPR -: 3426: inline pair<_ForwardIterator, _ForwardIterator> -: 3427: minmax_element(_ForwardIterator __first, _ForwardIterator __last, -: 3428: _Compare __comp) -: 3429: { -: 3430: // concept requirements -: 3431: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 3432: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 3433: typename iterator_traits<_ForwardIterator>::value_type, -: 3434: typename iterator_traits<_ForwardIterator>::value_type>) -: 3435: __glibcxx_requires_valid_range(__first, __last); -: 3436: -: 3437: return std::__minmax_element(__first, __last, -: 3438: __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 3439: } -: 3440: -: 3441: // N2722 + DR 915. -: 3442: template -: 3443: _GLIBCXX14_CONSTEXPR -: 3444: inline _Tp -: 3445: min(initializer_list<_Tp> __l) -: 3446: { return *std::min_element(__l.begin(), __l.end()); } -: 3447: -: 3448: template -: 3449: _GLIBCXX14_CONSTEXPR -: 3450: inline _Tp -: 3451: min(initializer_list<_Tp> __l, _Compare __comp) -: 3452: { return *std::min_element(__l.begin(), __l.end(), __comp); } -: 3453: -: 3454: template -: 3455: _GLIBCXX14_CONSTEXPR -: 3456: inline _Tp -: 3457: max(initializer_list<_Tp> __l) -: 3458: { return *std::max_element(__l.begin(), __l.end()); } -: 3459: -: 3460: template -: 3461: _GLIBCXX14_CONSTEXPR -: 3462: inline _Tp -: 3463: max(initializer_list<_Tp> __l, _Compare __comp) -: 3464: { return *std::max_element(__l.begin(), __l.end(), __comp); } -: 3465: -: 3466: template -: 3467: _GLIBCXX14_CONSTEXPR -: 3468: inline pair<_Tp, _Tp> -: 3469: minmax(initializer_list<_Tp> __l) -: 3470: { -: 3471: pair __p = -: 3472: std::minmax_element(__l.begin(), __l.end()); -: 3473: return std::make_pair(*__p.first, *__p.second); -: 3474: } -: 3475: -: 3476: template -: 3477: _GLIBCXX14_CONSTEXPR -: 3478: inline pair<_Tp, _Tp> -: 3479: minmax(initializer_list<_Tp> __l, _Compare __comp) -: 3480: { -: 3481: pair __p = -: 3482: std::minmax_element(__l.begin(), __l.end(), __comp); -: 3483: return std::make_pair(*__p.first, *__p.second); -: 3484: } -: 3485: -: 3486: template -: 3488: bool -: 3489: __is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, -: 3490: _ForwardIterator2 __first2, _BinaryPredicate __pred) -: 3491: { -: 3492: // Efficiently compare identical prefixes: O(N) if sequences -: 3493: // have the same elements in the same order. -: 3494: for (; __first1 != __last1; ++__first1, ++__first2) -: 3495: if (!__pred(__first1, __first2)) -: 3496: break; -: 3497: -: 3498: if (__first1 == __last1) -: 3499: return true; -: 3500: -: 3501: // Establish __last2 assuming equal ranges by iterating over the -: 3502: // rest of the list. -: 3503: _ForwardIterator2 __last2 = __first2; -: 3504: std::advance(__last2, std::distance(__first1, __last1)); -: 3505: for (_ForwardIterator1 __scan = __first1; __scan != __last1; ++__scan) -: 3506: { -: 3507: if (__scan != std::__find_if(__first1, __scan, -: 3508: __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan))) -: 3509: continue; // We've seen this one before. -: 3510: -: 3511: auto __matches -: 3512: = std::__count_if(__first2, __last2, -: 3513: __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)); -: 3514: if (0 == __matches || -: 3515: std::__count_if(__scan, __last1, -: 3516: __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)) -: 3517: != __matches) -: 3518: return false; -: 3519: } -: 3520: return true; -: 3521: } -: 3522: -: 3523: /** -: 3524: * @brief Checks whether a permutation of the second sequence is equal -: 3525: * to the first sequence. -: 3526: * @ingroup non_mutating_algorithms -: 3527: * @param __first1 Start of first range. -: 3528: * @param __last1 End of first range. -: 3529: * @param __first2 Start of second range. -: 3530: * @return true if there exists a permutation of the elements in the range -: 3531: * [__first2, __first2 + (__last1 - __first1)), beginning with -: 3532: * ForwardIterator2 begin, such that equal(__first1, __last1, begin) -: 3533: * returns true; otherwise, returns false. -: 3534: */ -: 3535: template -: 3536: inline bool -: 3537: is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, -: 3538: _ForwardIterator2 __first2) -: 3539: { -: 3540: // concept requirements -: 3541: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) -: 3542: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) -: 3543: __glibcxx_function_requires(_EqualOpConcept< -: 3544: typename iterator_traits<_ForwardIterator1>::value_type, -: 3545: typename iterator_traits<_ForwardIterator2>::value_type>) -: 3546: __glibcxx_requires_valid_range(__first1, __last1); -: 3547: -: 3548: return std::__is_permutation(__first1, __last1, __first2, -: 3549: __gnu_cxx::__ops::__iter_equal_to_iter()); -: 3550: } -: 3551: -: 3552: /** -: 3553: * @brief Checks whether a permutation of the second sequence is equal -: 3554: * to the first sequence. -: 3555: * @ingroup non_mutating_algorithms -: 3556: * @param __first1 Start of first range. -: 3557: * @param __last1 End of first range. -: 3558: * @param __first2 Start of second range. -: 3559: * @param __pred A binary predicate. -: 3560: * @return true if there exists a permutation of the elements in -: 3561: * the range [__first2, __first2 + (__last1 - __first1)), -: 3562: * beginning with ForwardIterator2 begin, such that -: 3563: * equal(__first1, __last1, __begin, __pred) returns true; -: 3564: * otherwise, returns false. -: 3565: */ -: 3566: template -: 3568: inline bool -: 3569: is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, -: 3570: _ForwardIterator2 __first2, _BinaryPredicate __pred) -: 3571: { -: 3572: // concept requirements -: 3573: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) -: 3574: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) -: 3575: __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, -: 3576: typename iterator_traits<_ForwardIterator1>::value_type, -: 3577: typename iterator_traits<_ForwardIterator2>::value_type>) -: 3578: __glibcxx_requires_valid_range(__first1, __last1); -: 3579: -: 3580: return std::__is_permutation(__first1, __last1, __first2, -: 3581: __gnu_cxx::__ops::__iter_comp_iter(__pred)); -: 3582: } -: 3583: -: 3584:#if __cplusplus > 201103L -: 3585: template -: 3587: bool -: 3588: __is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, -: 3589: _ForwardIterator2 __first2, _ForwardIterator2 __last2, -: 3590: _BinaryPredicate __pred) -: 3591: { -: 3592: using _Cat1 -: 3593: = typename iterator_traits<_ForwardIterator1>::iterator_category; -: 3594: using _Cat2 -: 3595: = typename iterator_traits<_ForwardIterator2>::iterator_category; -: 3596: using _It1_is_RA = is_same<_Cat1, random_access_iterator_tag>; -: 3597: using _It2_is_RA = is_same<_Cat2, random_access_iterator_tag>; -: 3598: constexpr bool __ra_iters = _It1_is_RA() && _It2_is_RA(); -: 3599: if (__ra_iters) -: 3600: { -: 3601: auto __d1 = std::distance(__first1, __last1); -: 3602: auto __d2 = std::distance(__first2, __last2); -: 3603: if (__d1 != __d2) -: 3604: return false; -: 3605: } -: 3606: -: 3607: // Efficiently compare identical prefixes: O(N) if sequences -: 3608: // have the same elements in the same order. -: 3609: for (; __first1 != __last1 && __first2 != __last2; -: 3610: ++__first1, ++__first2) -: 3611: if (!__pred(__first1, __first2)) -: 3612: break; -: 3613: -: 3614: if (__ra_iters) -: 3615: { -: 3616: if (__first1 == __last1) -: 3617: return true; -: 3618: } -: 3619: else -: 3620: { -: 3621: auto __d1 = std::distance(__first1, __last1); -: 3622: auto __d2 = std::distance(__first2, __last2); -: 3623: if (__d1 == 0 && __d2 == 0) -: 3624: return true; -: 3625: if (__d1 != __d2) -: 3626: return false; -: 3627: } -: 3628: -: 3629: for (_ForwardIterator1 __scan = __first1; __scan != __last1; ++__scan) -: 3630: { -: 3631: if (__scan != std::__find_if(__first1, __scan, -: 3632: __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan))) -: 3633: continue; // We've seen this one before. -: 3634: -: 3635: auto __matches = std::__count_if(__first2, __last2, -: 3636: __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)); -: 3637: if (0 == __matches -: 3638: || std::__count_if(__scan, __last1, -: 3639: __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)) -: 3640: != __matches) -: 3641: return false; -: 3642: } -: 3643: return true; -: 3644: } -: 3645: -: 3646: /** -: 3647: * @brief Checks whether a permutaion of the second sequence is equal -: 3648: * to the first sequence. -: 3649: * @ingroup non_mutating_algorithms -: 3650: * @param __first1 Start of first range. -: 3651: * @param __last1 End of first range. -: 3652: * @param __first2 Start of second range. -: 3653: * @param __last2 End of first range. -: 3654: * @return true if there exists a permutation of the elements in the range -: 3655: * [__first2, __last2), beginning with ForwardIterator2 begin, -: 3656: * such that equal(__first1, __last1, begin) returns true; -: 3657: * otherwise, returns false. -: 3658: */ -: 3659: template -: 3660: inline bool -: 3661: is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, -: 3662: _ForwardIterator2 __first2, _ForwardIterator2 __last2) -: 3663: { -: 3664: __glibcxx_requires_valid_range(__first1, __last1); -: 3665: __glibcxx_requires_valid_range(__first2, __last2); -: 3666: -: 3667: return -: 3668: std::__is_permutation(__first1, __last1, __first2, __last2, -: 3669: __gnu_cxx::__ops::__iter_equal_to_iter()); -: 3670: } -: 3671: -: 3672: /** -: 3673: * @brief Checks whether a permutation of the second sequence is equal -: 3674: * to the first sequence. -: 3675: * @ingroup non_mutating_algorithms -: 3676: * @param __first1 Start of first range. -: 3677: * @param __last1 End of first range. -: 3678: * @param __first2 Start of second range. -: 3679: * @param __last2 End of first range. -: 3680: * @param __pred A binary predicate. -: 3681: * @return true if there exists a permutation of the elements in the range -: 3682: * [__first2, __last2), beginning with ForwardIterator2 begin, -: 3683: * such that equal(__first1, __last1, __begin, __pred) returns true; -: 3684: * otherwise, returns false. -: 3685: */ -: 3686: template -: 3688: inline bool -: 3689: is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, -: 3690: _ForwardIterator2 __first2, _ForwardIterator2 __last2, -: 3691: _BinaryPredicate __pred) -: 3692: { -: 3693: __glibcxx_requires_valid_range(__first1, __last1); -: 3694: __glibcxx_requires_valid_range(__first2, __last2); -: 3695: -: 3696: return std::__is_permutation(__first1, __last1, __first2, __last2, -: 3697: __gnu_cxx::__ops::__iter_comp_iter(__pred)); -: 3698: } -: 3699:#endif -: 3700: -: 3701:#ifdef _GLIBCXX_USE_C99_STDINT_TR1 -: 3702: /** -: 3703: * @brief Shuffle the elements of a sequence using a uniform random -: 3704: * number generator. -: 3705: * @ingroup mutating_algorithms -: 3706: * @param __first A forward iterator. -: 3707: * @param __last A forward iterator. -: 3708: * @param __g A UniformRandomNumberGenerator (26.5.1.3). -: 3709: * @return Nothing. -: 3710: * -: 3711: * Reorders the elements in the range @p [__first,__last) using @p __g to -: 3712: * provide random numbers. -: 3713: */ -: 3714: template -: 3716: void -: 3717: shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, -: 3718: _UniformRandomNumberGenerator&& __g) -: 3719: { -: 3720: // concept requirements -: 3721: __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< -: 3722: _RandomAccessIterator>) -: 3723: __glibcxx_requires_valid_range(__first, __last); -: 3724: -: 3725: if (__first == __last) -: 3726: return; -: 3727: -: 3728: typedef typename iterator_traits<_RandomAccessIterator>::difference_type -: 3729: _DistanceType; -: 3730: -: 3731: typedef typename std::make_unsigned<_DistanceType>::type __ud_type; -: 3732: typedef typename std::uniform_int_distribution<__ud_type> __distr_type; -: 3733: typedef typename __distr_type::param_type __p_type; -: 3734: __distr_type __d; -: 3735: -: 3736: for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) -: 3737: std::iter_swap(__i, __first + __d(__g, __p_type(0, __i - __first))); -: 3738: } -: 3739:#endif -: 3740: -: 3741:#endif // C++11 -: 3742: -: 3743:_GLIBCXX_END_NAMESPACE_VERSION -: 3744: -: 3745:_GLIBCXX_BEGIN_NAMESPACE_ALGO -: 3746: -: 3747: /** -: 3748: * @brief Apply a function to every element of a sequence. -: 3749: * @ingroup non_mutating_algorithms -: 3750: * @param __first An input iterator. -: 3751: * @param __last An input iterator. -: 3752: * @param __f A unary function object. -: 3753: * @return @p __f (std::move(@p __f) in C++0x). -: 3754: * -: 3755: * Applies the function object @p __f to each element in the range -: 3756: * @p [first,last). @p __f must not modify the order of the sequence. -: 3757: * If @p __f has a return value it is ignored. -: 3758: */ -: 3759: template -: 3760: _Function -: 3761: for_each(_InputIterator __first, _InputIterator __last, _Function __f) -: 3762: { -: 3763: // concept requirements -: 3764: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 3765: __glibcxx_requires_valid_range(__first, __last); -: 3766: for (; __first != __last; ++__first) -: 3767: __f(*__first); -: 3768: return _GLIBCXX_MOVE(__f); -: 3769: } -: 3770: -: 3771: /** -: 3772: * @brief Find the first occurrence of a value in a sequence. -: 3773: * @ingroup non_mutating_algorithms -: 3774: * @param __first An input iterator. -: 3775: * @param __last An input iterator. -: 3776: * @param __val The value to find. -: 3777: * @return The first iterator @c i in the range @p [__first,__last) -: 3778: * such that @c *i == @p __val, or @p __last if no such iterator exists. -: 3779: */ -: 3780: template -: 3781: inline _InputIterator -: 3782: find(_InputIterator __first, _InputIterator __last, -: 3783: const _Tp& __val) -: 3784: { -: 3785: // concept requirements -: 3786: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 3787: __glibcxx_function_requires(_EqualOpConcept< -: 3788: typename iterator_traits<_InputIterator>::value_type, _Tp>) -: 3789: __glibcxx_requires_valid_range(__first, __last); -: 3790: return std::__find_if(__first, __last, -: 3791: __gnu_cxx::__ops::__iter_equals_val(__val)); -: 3792: } -: 3793: -: 3794: /** -: 3795: * @brief Find the first element in a sequence for which a -: 3796: * predicate is true. -: 3797: * @ingroup non_mutating_algorithms -: 3798: * @param __first An input iterator. -: 3799: * @param __last An input iterator. -: 3800: * @param __pred A predicate. -: 3801: * @return The first iterator @c i in the range @p [__first,__last) -: 3802: * such that @p __pred(*i) is true, or @p __last if no such iterator exists. -: 3803: */ -: 3804: template -: 3805: inline _InputIterator -: 3806: find_if(_InputIterator __first, _InputIterator __last, -: 3807: _Predicate __pred) -: 3808: { -: 3809: // concept requirements -: 3810: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 3811: __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, -: 3812: typename iterator_traits<_InputIterator>::value_type>) -: 3813: __glibcxx_requires_valid_range(__first, __last); -: 3814: -: 3815: return std::__find_if(__first, __last, -: 3816: __gnu_cxx::__ops::__pred_iter(__pred)); -: 3817: } -: 3818: -: 3819: /** -: 3820: * @brief Find element from a set in a sequence. -: 3821: * @ingroup non_mutating_algorithms -: 3822: * @param __first1 Start of range to search. -: 3823: * @param __last1 End of range to search. -: 3824: * @param __first2 Start of match candidates. -: 3825: * @param __last2 End of match candidates. -: 3826: * @return The first iterator @c i in the range -: 3827: * @p [__first1,__last1) such that @c *i == @p *(i2) such that i2 is an -: 3828: * iterator in [__first2,__last2), or @p __last1 if no such iterator exists. -: 3829: * -: 3830: * Searches the range @p [__first1,__last1) for an element that is -: 3831: * equal to some element in the range [__first2,__last2). If -: 3832: * found, returns an iterator in the range [__first1,__last1), -: 3833: * otherwise returns @p __last1. -: 3834: */ -: 3835: template -: 3836: _InputIterator -: 3837: find_first_of(_InputIterator __first1, _InputIterator __last1, -: 3838: _ForwardIterator __first2, _ForwardIterator __last2) -: 3839: { -: 3840: // concept requirements -: 3841: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 3842: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 3843: __glibcxx_function_requires(_EqualOpConcept< -: 3844: typename iterator_traits<_InputIterator>::value_type, -: 3845: typename iterator_traits<_ForwardIterator>::value_type>) -: 3846: __glibcxx_requires_valid_range(__first1, __last1); -: 3847: __glibcxx_requires_valid_range(__first2, __last2); -: 3848: -: 3849: for (; __first1 != __last1; ++__first1) -: 3850: for (_ForwardIterator __iter = __first2; __iter != __last2; ++__iter) -: 3851: if (*__first1 == *__iter) -: 3852: return __first1; -: 3853: return __last1; -: 3854: } -: 3855: -: 3856: /** -: 3857: * @brief Find element from a set in a sequence using a predicate. -: 3858: * @ingroup non_mutating_algorithms -: 3859: * @param __first1 Start of range to search. -: 3860: * @param __last1 End of range to search. -: 3861: * @param __first2 Start of match candidates. -: 3862: * @param __last2 End of match candidates. -: 3863: * @param __comp Predicate to use. -: 3864: * @return The first iterator @c i in the range -: 3865: * @p [__first1,__last1) such that @c comp(*i, @p *(i2)) is true -: 3866: * and i2 is an iterator in [__first2,__last2), or @p __last1 if no -: 3867: * such iterator exists. -: 3868: * -: 3869: -: 3870: * Searches the range @p [__first1,__last1) for an element that is -: 3871: * equal to some element in the range [__first2,__last2). If -: 3872: * found, returns an iterator in the range [__first1,__last1), -: 3873: * otherwise returns @p __last1. -: 3874: */ -: 3875: template -: 3877: _InputIterator -: 3878: find_first_of(_InputIterator __first1, _InputIterator __last1, -: 3879: _ForwardIterator __first2, _ForwardIterator __last2, -: 3880: _BinaryPredicate __comp) -: 3881: { -: 3882: // concept requirements -: 3883: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 3884: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 3885: __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, -: 3886: typename iterator_traits<_InputIterator>::value_type, -: 3887: typename iterator_traits<_ForwardIterator>::value_type>) -: 3888: __glibcxx_requires_valid_range(__first1, __last1); -: 3889: __glibcxx_requires_valid_range(__first2, __last2); -: 3890: -: 3891: for (; __first1 != __last1; ++__first1) -: 3892: for (_ForwardIterator __iter = __first2; __iter != __last2; ++__iter) -: 3893: if (__comp(*__first1, *__iter)) -: 3894: return __first1; -: 3895: return __last1; -: 3896: } -: 3897: -: 3898: /** -: 3899: * @brief Find two adjacent values in a sequence that are equal. -: 3900: * @ingroup non_mutating_algorithms -: 3901: * @param __first A forward iterator. -: 3902: * @param __last A forward iterator. -: 3903: * @return The first iterator @c i such that @c i and @c i+1 are both -: 3904: * valid iterators in @p [__first,__last) and such that @c *i == @c *(i+1), -: 3905: * or @p __last if no such iterator exists. -: 3906: */ -: 3907: template -: 3908: inline _ForwardIterator -: 3909: adjacent_find(_ForwardIterator __first, _ForwardIterator __last) -: 3910: { -: 3911: // concept requirements -: 3912: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 3913: __glibcxx_function_requires(_EqualityComparableConcept< -: 3914: typename iterator_traits<_ForwardIterator>::value_type>) -: 3915: __glibcxx_requires_valid_range(__first, __last); -: 3916: -: 3917: return std::__adjacent_find(__first, __last, -: 3918: __gnu_cxx::__ops::__iter_equal_to_iter()); -: 3919: } -: 3920: -: 3921: /** -: 3922: * @brief Find two adjacent values in a sequence using a predicate. -: 3923: * @ingroup non_mutating_algorithms -: 3924: * @param __first A forward iterator. -: 3925: * @param __last A forward iterator. -: 3926: * @param __binary_pred A binary predicate. -: 3927: * @return The first iterator @c i such that @c i and @c i+1 are both -: 3928: * valid iterators in @p [__first,__last) and such that -: 3929: * @p __binary_pred(*i,*(i+1)) is true, or @p __last if no such iterator -: 3930: * exists. -: 3931: */ -: 3932: template -: 3933: inline _ForwardIterator -: 3934: adjacent_find(_ForwardIterator __first, _ForwardIterator __last, -: 3935: _BinaryPredicate __binary_pred) -: 3936: { -: 3937: // concept requirements -: 3938: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 3939: __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, -: 3940: typename iterator_traits<_ForwardIterator>::value_type, -: 3941: typename iterator_traits<_ForwardIterator>::value_type>) -: 3942: __glibcxx_requires_valid_range(__first, __last); -: 3943: -: 3944: return std::__adjacent_find(__first, __last, -: 3945: __gnu_cxx::__ops::__iter_comp_iter(__binary_pred)); -: 3946: } -: 3947: -: 3948: /** -: 3949: * @brief Count the number of copies of a value in a sequence. -: 3950: * @ingroup non_mutating_algorithms -: 3951: * @param __first An input iterator. -: 3952: * @param __last An input iterator. -: 3953: * @param __value The value to be counted. -: 3954: * @return The number of iterators @c i in the range @p [__first,__last) -: 3955: * for which @c *i == @p __value -: 3956: */ -: 3957: template -: 3958: inline typename iterator_traits<_InputIterator>::difference_type function _ZSt5countIN9__gnu_cxx17__normal_iteratorIPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS7_SaIS7_EEEES7_ENSt15iterator_traitsIT_E15difference_typeESF_SF_RKT0_ called 0 returned 0% blocks executed 0% #####: 3959: count(_InputIterator __first, _InputIterator __last, const _Tp& __value) -: 3960: { -: 3961: // concept requirements -: 3962: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 3963: __glibcxx_function_requires(_EqualOpConcept< -: 3964: typename iterator_traits<_InputIterator>::value_type, _Tp>) -: 3965: __glibcxx_requires_valid_range(__first, __last); -: 3966: #####: 3967: return std::__count_if(__first, __last, call 0 never executed call 1 never executed #####: 3968: __gnu_cxx::__ops::__iter_equals_val(__value)); call 0 never executed -: 3969: } -: 3970: -: 3971: /** -: 3972: * @brief Count the elements of a sequence for which a predicate is true. -: 3973: * @ingroup non_mutating_algorithms -: 3974: * @param __first An input iterator. -: 3975: * @param __last An input iterator. -: 3976: * @param __pred A predicate. -: 3977: * @return The number of iterators @c i in the range @p [__first,__last) -: 3978: * for which @p __pred(*i) is true. -: 3979: */ -: 3980: template -: 3981: inline typename iterator_traits<_InputIterator>::difference_type function _ZSt8count_ifIN9__gnu_cxx17__normal_iteratorIPK6bulletSt6vectorIS2_SaIS2_EEEEZN41power_stop_bullets_actually_stops_bullets11test_methodEvEUlRKT_E0_ENSt15iterator_traitsISA_E15difference_typeESA_SA_T0_ called 1 returned 100% blocks executed 100% function _ZSt8count_ifIN9__gnu_cxx17__normal_iteratorIPK6bulletSt6vectorIS2_SaIS2_EEEEZN41power_stop_bullets_actually_stops_bullets11test_methodEvEUlRKT_E_ENSt15iterator_traitsISA_E15difference_typeESA_SA_T0_ called 1 returned 100% blocks executed 100% 2: 3982: count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) -: 3983: { -: 3984: // concept requirements -: 3985: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 3986: __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, -: 3987: typename iterator_traits<_InputIterator>::value_type>) -: 3988: __glibcxx_requires_valid_range(__first, __last); -: 3989: 2: 3990: return std::__count_if(__first, __last, call 0 returned 100% call 1 returned 100% 2: 3991: __gnu_cxx::__ops::__pred_iter(__pred)); call 0 returned 100% call 1 returned 100% -: 3992: } -: 3993: -: 3994: /** -: 3995: * @brief Search a sequence for a matching sub-sequence. -: 3996: * @ingroup non_mutating_algorithms -: 3997: * @param __first1 A forward iterator. -: 3998: * @param __last1 A forward iterator. -: 3999: * @param __first2 A forward iterator. -: 4000: * @param __last2 A forward iterator. -: 4001: * @return The first iterator @c i in the range @p -: 4002: * [__first1,__last1-(__last2-__first2)) such that @c *(i+N) == @p -: 4003: * *(__first2+N) for each @c N in the range @p -: 4004: * [0,__last2-__first2), or @p __last1 if no such iterator exists. -: 4005: * -: 4006: * Searches the range @p [__first1,__last1) for a sub-sequence that -: 4007: * compares equal value-by-value with the sequence given by @p -: 4008: * [__first2,__last2) and returns an iterator to the first element -: 4009: * of the sub-sequence, or @p __last1 if the sub-sequence is not -: 4010: * found. -: 4011: * -: 4012: * Because the sub-sequence must lie completely within the range @p -: 4013: * [__first1,__last1) it must start at a position less than @p -: 4014: * __last1-(__last2-__first2) where @p __last2-__first2 is the -: 4015: * length of the sub-sequence. -: 4016: * -: 4017: * This means that the returned iterator @c i will be in the range -: 4018: * @p [__first1,__last1-(__last2-__first2)) -: 4019: */ -: 4020: template -: 4021: inline _ForwardIterator1 -: 4022: search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, -: 4023: _ForwardIterator2 __first2, _ForwardIterator2 __last2) -: 4024: { -: 4025: // concept requirements -: 4026: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) -: 4027: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) -: 4028: __glibcxx_function_requires(_EqualOpConcept< -: 4029: typename iterator_traits<_ForwardIterator1>::value_type, -: 4030: typename iterator_traits<_ForwardIterator2>::value_type>) -: 4031: __glibcxx_requires_valid_range(__first1, __last1); -: 4032: __glibcxx_requires_valid_range(__first2, __last2); -: 4033: -: 4034: return std::__search(__first1, __last1, __first2, __last2, -: 4035: __gnu_cxx::__ops::__iter_equal_to_iter()); -: 4036: } -: 4037: -: 4038: /** -: 4039: * @brief Search a sequence for a matching sub-sequence using a predicate. -: 4040: * @ingroup non_mutating_algorithms -: 4041: * @param __first1 A forward iterator. -: 4042: * @param __last1 A forward iterator. -: 4043: * @param __first2 A forward iterator. -: 4044: * @param __last2 A forward iterator. -: 4045: * @param __predicate A binary predicate. -: 4046: * @return The first iterator @c i in the range -: 4047: * @p [__first1,__last1-(__last2-__first2)) such that -: 4048: * @p __predicate(*(i+N),*(__first2+N)) is true for each @c N in the range -: 4049: * @p [0,__last2-__first2), or @p __last1 if no such iterator exists. -: 4050: * -: 4051: * Searches the range @p [__first1,__last1) for a sub-sequence that -: 4052: * compares equal value-by-value with the sequence given by @p -: 4053: * [__first2,__last2), using @p __predicate to determine equality, -: 4054: * and returns an iterator to the first element of the -: 4055: * sub-sequence, or @p __last1 if no such iterator exists. -: 4056: * -: 4057: * @see search(_ForwardIter1, _ForwardIter1, _ForwardIter2, _ForwardIter2) -: 4058: */ -: 4059: template -: 4061: inline _ForwardIterator1 -: 4062: search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, -: 4063: _ForwardIterator2 __first2, _ForwardIterator2 __last2, -: 4064: _BinaryPredicate __predicate) -: 4065: { -: 4066: // concept requirements -: 4067: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) -: 4068: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) -: 4069: __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, -: 4070: typename iterator_traits<_ForwardIterator1>::value_type, -: 4071: typename iterator_traits<_ForwardIterator2>::value_type>) -: 4072: __glibcxx_requires_valid_range(__first1, __last1); -: 4073: __glibcxx_requires_valid_range(__first2, __last2); -: 4074: -: 4075: return std::__search(__first1, __last1, __first2, __last2, -: 4076: __gnu_cxx::__ops::__iter_comp_iter(__predicate)); -: 4077: } -: 4078: -: 4079: /** -: 4080: * @brief Search a sequence for a number of consecutive values. -: 4081: * @ingroup non_mutating_algorithms -: 4082: * @param __first A forward iterator. -: 4083: * @param __last A forward iterator. -: 4084: * @param __count The number of consecutive values. -: 4085: * @param __val The value to find. -: 4086: * @return The first iterator @c i in the range @p -: 4087: * [__first,__last-__count) such that @c *(i+N) == @p __val for -: 4088: * each @c N in the range @p [0,__count), or @p __last if no such -: 4089: * iterator exists. -: 4090: * -: 4091: * Searches the range @p [__first,__last) for @p count consecutive elements -: 4092: * equal to @p __val. -: 4093: */ -: 4094: template -: 4095: inline _ForwardIterator -: 4096: search_n(_ForwardIterator __first, _ForwardIterator __last, -: 4097: _Integer __count, const _Tp& __val) -: 4098: { -: 4099: // concept requirements -: 4100: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 4101: __glibcxx_function_requires(_EqualOpConcept< -: 4102: typename iterator_traits<_ForwardIterator>::value_type, _Tp>) -: 4103: __glibcxx_requires_valid_range(__first, __last); -: 4104: -: 4105: return std::__search_n(__first, __last, __count, -: 4106: __gnu_cxx::__ops::__iter_equals_val(__val)); -: 4107: } -: 4108: -: 4109: -: 4110: /** -: 4111: * @brief Search a sequence for a number of consecutive values using a -: 4112: * predicate. -: 4113: * @ingroup non_mutating_algorithms -: 4114: * @param __first A forward iterator. -: 4115: * @param __last A forward iterator. -: 4116: * @param __count The number of consecutive values. -: 4117: * @param __val The value to find. -: 4118: * @param __binary_pred A binary predicate. -: 4119: * @return The first iterator @c i in the range @p -: 4120: * [__first,__last-__count) such that @p -: 4121: * __binary_pred(*(i+N),__val) is true for each @c N in the range -: 4122: * @p [0,__count), or @p __last if no such iterator exists. -: 4123: * -: 4124: * Searches the range @p [__first,__last) for @p __count -: 4125: * consecutive elements for which the predicate returns true. -: 4126: */ -: 4127: template -: 4129: inline _ForwardIterator -: 4130: search_n(_ForwardIterator __first, _ForwardIterator __last, -: 4131: _Integer __count, const _Tp& __val, -: 4132: _BinaryPredicate __binary_pred) -: 4133: { -: 4134: // concept requirements -: 4135: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 4136: __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, -: 4137: typename iterator_traits<_ForwardIterator>::value_type, _Tp>) -: 4138: __glibcxx_requires_valid_range(__first, __last); -: 4139: -: 4140: return std::__search_n(__first, __last, __count, -: 4141: __gnu_cxx::__ops::__iter_comp_val(__binary_pred, __val)); -: 4142: } -: 4143: -: 4144: -: 4145: /** -: 4146: * @brief Perform an operation on a sequence. -: 4147: * @ingroup mutating_algorithms -: 4148: * @param __first An input iterator. -: 4149: * @param __last An input iterator. -: 4150: * @param __result An output iterator. -: 4151: * @param __unary_op A unary operator. -: 4152: * @return An output iterator equal to @p __result+(__last-__first). -: 4153: * -: 4154: * Applies the operator to each element in the input range and assigns -: 4155: * the results to successive elements of the output sequence. -: 4156: * Evaluates @p *(__result+N)=unary_op(*(__first+N)) for each @c N in the -: 4157: * range @p [0,__last-__first). -: 4158: * -: 4159: * @p unary_op must not alter its argument. -: 4160: */ -: 4161: template -: 4163: _OutputIterator function _ZSt9transformIN9__gnu_cxx17__normal_iteratorIP10amino_acidSt6vectorIS2_SaIS2_EEEESt20back_insert_iteratorIS4_INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISE_EEEZ14create_spritesvEUlS2_E_ET0_T_SK_SJ_T1_ called 1 returned 100% blocks executed 94% function _ZSt9transformIN9__gnu_cxx17__normal_iteratorIPK6playerSt6vectorIS2_SaIS2_EEEESt20back_insert_iteratorIS5_IdSaIdEEEZ18collect_hit_pointsRK4gameEUlRKT_E_ET0_SG_SG_SK_T1_ called 0 returned 0% blocks executed 0% 21: 4164: transform(_InputIterator __first, _InputIterator __last, -: 4165: _OutputIterator __result, _UnaryOperation __unary_op) -: 4166: { -: 4167: // concept requirements -: 4168: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 4169: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 4170: // "the type returned by a _UnaryOperation" -: 4171: __typeof__(__unary_op(*__first))>) -: 4172: __glibcxx_requires_valid_range(__first, __last); -: 4173: 41: 4174: for (; __first != __last; ++__first, ++__result) call 0 returned 100% branch 1 taken 95% (fallthrough) branch 2 taken 5% call 3 returned 100% call 4 returned 100% call 5 never executed branch 6 never executed branch 7 never executed call 8 never executed call 9 never executed 20: 4175: *__result = __unary_op(*__first); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% call 6 returned 100% branch 7 taken 100% (fallthrough) branch 8 taken 0% (throw) call 9 returned 100% call 10 never executed call 11 never executed call 12 never executed call 13 never executed call 14 never executed call 15 never executed call 16 never executed call 17 never executed branch 18 never executed branch 19 never executed 1: 4176: return __result; -: 4177: } -: 4178: -: 4179: /** -: 4180: * @brief Perform an operation on corresponding elements of two sequences. -: 4181: * @ingroup mutating_algorithms -: 4182: * @param __first1 An input iterator. -: 4183: * @param __last1 An input iterator. -: 4184: * @param __first2 An input iterator. -: 4185: * @param __result An output iterator. -: 4186: * @param __binary_op A binary operator. -: 4187: * @return An output iterator equal to @p result+(last-first). -: 4188: * -: 4189: * Applies the operator to the corresponding elements in the two -: 4190: * input ranges and assigns the results to successive elements of the -: 4191: * output sequence. -: 4192: * Evaluates @p -: 4193: * *(__result+N)=__binary_op(*(__first1+N),*(__first2+N)) for each -: 4194: * @c N in the range @p [0,__last1-__first1). -: 4195: * -: 4196: * @p binary_op must not alter either of its arguments. -: 4197: */ -: 4198: template -: 4200: _OutputIterator -: 4201: transform(_InputIterator1 __first1, _InputIterator1 __last1, -: 4202: _InputIterator2 __first2, _OutputIterator __result, -: 4203: _BinaryOperation __binary_op) -: 4204: { -: 4205: // concept requirements -: 4206: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) -: 4207: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) -: 4208: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 4209: // "the type returned by a _BinaryOperation" -: 4210: __typeof__(__binary_op(*__first1,*__first2))>) -: 4211: __glibcxx_requires_valid_range(__first1, __last1); -: 4212: -: 4213: for (; __first1 != __last1; ++__first1, ++__first2, ++__result) -: 4214: *__result = __binary_op(*__first1, *__first2); -: 4215: return __result; -: 4216: } -: 4217: -: 4218: /** -: 4219: * @brief Replace each occurrence of one value in a sequence with another -: 4220: * value. -: 4221: * @ingroup mutating_algorithms -: 4222: * @param __first A forward iterator. -: 4223: * @param __last A forward iterator. -: 4224: * @param __old_value The value to be replaced. -: 4225: * @param __new_value The replacement value. -: 4226: * @return replace() returns no value. -: 4227: * -: 4228: * For each iterator @c i in the range @p [__first,__last) if @c *i == -: 4229: * @p __old_value then the assignment @c *i = @p __new_value is performed. -: 4230: */ -: 4231: template -: 4232: void -: 4233: replace(_ForwardIterator __first, _ForwardIterator __last, -: 4234: const _Tp& __old_value, const _Tp& __new_value) -: 4235: { -: 4236: // concept requirements -: 4237: __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< -: 4238: _ForwardIterator>) -: 4239: __glibcxx_function_requires(_EqualOpConcept< -: 4240: typename iterator_traits<_ForwardIterator>::value_type, _Tp>) -: 4241: __glibcxx_function_requires(_ConvertibleConcept<_Tp, -: 4242: typename iterator_traits<_ForwardIterator>::value_type>) -: 4243: __glibcxx_requires_valid_range(__first, __last); -: 4244: -: 4245: for (; __first != __last; ++__first) -: 4246: if (*__first == __old_value) -: 4247: *__first = __new_value; -: 4248: } -: 4249: -: 4250: /** -: 4251: * @brief Replace each value in a sequence for which a predicate returns -: 4252: * true with another value. -: 4253: * @ingroup mutating_algorithms -: 4254: * @param __first A forward iterator. -: 4255: * @param __last A forward iterator. -: 4256: * @param __pred A predicate. -: 4257: * @param __new_value The replacement value. -: 4258: * @return replace_if() returns no value. -: 4259: * -: 4260: * For each iterator @c i in the range @p [__first,__last) if @p __pred(*i) -: 4261: * is true then the assignment @c *i = @p __new_value is performed. -: 4262: */ -: 4263: template -: 4264: void -: 4265: replace_if(_ForwardIterator __first, _ForwardIterator __last, -: 4266: _Predicate __pred, const _Tp& __new_value) -: 4267: { -: 4268: // concept requirements -: 4269: __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< -: 4270: _ForwardIterator>) -: 4271: __glibcxx_function_requires(_ConvertibleConcept<_Tp, -: 4272: typename iterator_traits<_ForwardIterator>::value_type>) -: 4273: __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, -: 4274: typename iterator_traits<_ForwardIterator>::value_type>) -: 4275: __glibcxx_requires_valid_range(__first, __last); -: 4276: -: 4277: for (; __first != __last; ++__first) -: 4278: if (__pred(*__first)) -: 4279: *__first = __new_value; -: 4280: } -: 4281: -: 4282: /** -: 4283: * @brief Assign the result of a function object to each value in a -: 4284: * sequence. -: 4285: * @ingroup mutating_algorithms -: 4286: * @param __first A forward iterator. -: 4287: * @param __last A forward iterator. -: 4288: * @param __gen A function object taking no arguments and returning -: 4289: * std::iterator_traits<_ForwardIterator>::value_type -: 4290: * @return generate() returns no value. -: 4291: * -: 4292: * Performs the assignment @c *i = @p __gen() for each @c i in the range -: 4293: * @p [__first,__last). -: 4294: */ -: 4295: template -: 4296: void -: 4297: generate(_ForwardIterator __first, _ForwardIterator __last, -: 4298: _Generator __gen) -: 4299: { -: 4300: // concept requirements -: 4301: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 4302: __glibcxx_function_requires(_GeneratorConcept<_Generator, -: 4303: typename iterator_traits<_ForwardIterator>::value_type>) -: 4304: __glibcxx_requires_valid_range(__first, __last); -: 4305: -: 4306: for (; __first != __last; ++__first) -: 4307: *__first = __gen(); -: 4308: } -: 4309: -: 4310: /** -: 4311: * @brief Assign the result of a function object to each value in a -: 4312: * sequence. -: 4313: * @ingroup mutating_algorithms -: 4314: * @param __first A forward iterator. -: 4315: * @param __n The length of the sequence. -: 4316: * @param __gen A function object taking no arguments and returning -: 4317: * std::iterator_traits<_ForwardIterator>::value_type -: 4318: * @return The end of the sequence, @p __first+__n -: 4319: * -: 4320: * Performs the assignment @c *i = @p __gen() for each @c i in the range -: 4321: * @p [__first,__first+__n). -: 4322: * -: 4323: * _GLIBCXX_RESOLVE_LIB_DEFECTS -: 4324: * DR 865. More algorithms that throw away information -: 4325: */ -: 4326: template -: 4327: _OutputIterator -: 4328: generate_n(_OutputIterator __first, _Size __n, _Generator __gen) -: 4329: { -: 4330: // concept requirements -: 4331: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 4332: // "the type returned by a _Generator" -: 4333: __typeof__(__gen())>) -: 4334: -: 4335: for (__decltype(__n + 0) __niter = __n; -: 4336: __niter > 0; --__niter, ++__first) -: 4337: *__first = __gen(); -: 4338: return __first; -: 4339: } -: 4340: -: 4341: /** -: 4342: * @brief Copy a sequence, removing consecutive duplicate values. -: 4343: * @ingroup mutating_algorithms -: 4344: * @param __first An input iterator. -: 4345: * @param __last An input iterator. -: 4346: * @param __result An output iterator. -: 4347: * @return An iterator designating the end of the resulting sequence. -: 4348: * -: 4349: * Copies each element in the range @p [__first,__last) to the range -: 4350: * beginning at @p __result, except that only the first element is copied -: 4351: * from groups of consecutive elements that compare equal. -: 4352: * unique_copy() is stable, so the relative order of elements that are -: 4353: * copied is unchanged. -: 4354: * -: 4355: * _GLIBCXX_RESOLVE_LIB_DEFECTS -: 4356: * DR 241. Does unique_copy() require CopyConstructible and Assignable? -: 4357: * -: 4358: * _GLIBCXX_RESOLVE_LIB_DEFECTS -: 4359: * DR 538. 241 again: Does unique_copy() require CopyConstructible and -: 4360: * Assignable? -: 4361: */ -: 4362: template -: 4363: inline _OutputIterator -: 4364: unique_copy(_InputIterator __first, _InputIterator __last, -: 4365: _OutputIterator __result) -: 4366: { -: 4367: // concept requirements -: 4368: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 4369: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 4370: typename iterator_traits<_InputIterator>::value_type>) -: 4371: __glibcxx_function_requires(_EqualityComparableConcept< -: 4372: typename iterator_traits<_InputIterator>::value_type>) -: 4373: __glibcxx_requires_valid_range(__first, __last); -: 4374: -: 4375: if (__first == __last) -: 4376: return __result; -: 4377: return std::__unique_copy(__first, __last, __result, -: 4378: __gnu_cxx::__ops::__iter_equal_to_iter(), -: 4379: std::__iterator_category(__first), -: 4380: std::__iterator_category(__result)); -: 4381: } -: 4382: -: 4383: /** -: 4384: * @brief Copy a sequence, removing consecutive values using a predicate. -: 4385: * @ingroup mutating_algorithms -: 4386: * @param __first An input iterator. -: 4387: * @param __last An input iterator. -: 4388: * @param __result An output iterator. -: 4389: * @param __binary_pred A binary predicate. -: 4390: * @return An iterator designating the end of the resulting sequence. -: 4391: * -: 4392: * Copies each element in the range @p [__first,__last) to the range -: 4393: * beginning at @p __result, except that only the first element is copied -: 4394: * from groups of consecutive elements for which @p __binary_pred returns -: 4395: * true. -: 4396: * unique_copy() is stable, so the relative order of elements that are -: 4397: * copied is unchanged. -: 4398: * -: 4399: * _GLIBCXX_RESOLVE_LIB_DEFECTS -: 4400: * DR 241. Does unique_copy() require CopyConstructible and Assignable? -: 4401: */ -: 4402: template -: 4404: inline _OutputIterator -: 4405: unique_copy(_InputIterator __first, _InputIterator __last, -: 4406: _OutputIterator __result, -: 4407: _BinaryPredicate __binary_pred) -: 4408: { -: 4409: // concept requirements -- predicates checked later -: 4410: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) -: 4411: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 4412: typename iterator_traits<_InputIterator>::value_type>) -: 4413: __glibcxx_requires_valid_range(__first, __last); -: 4414: -: 4415: if (__first == __last) -: 4416: return __result; -: 4417: return std::__unique_copy(__first, __last, __result, -: 4418: __gnu_cxx::__ops::__iter_comp_iter(__binary_pred), -: 4419: std::__iterator_category(__first), -: 4420: std::__iterator_category(__result)); -: 4421: } -: 4422: -: 4423: /** -: 4424: * @brief Randomly shuffle the elements of a sequence. -: 4425: * @ingroup mutating_algorithms -: 4426: * @param __first A forward iterator. -: 4427: * @param __last A forward iterator. -: 4428: * @return Nothing. -: 4429: * -: 4430: * Reorder the elements in the range @p [__first,__last) using a random -: 4431: * distribution, so that every possible ordering of the sequence is -: 4432: * equally likely. -: 4433: */ -: 4434: template -: 4435: inline void -: 4436: random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last) -: 4437: { -: 4438: // concept requirements -: 4439: __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< -: 4440: _RandomAccessIterator>) -: 4441: __glibcxx_requires_valid_range(__first, __last); -: 4442: -: 4443: if (__first != __last) -: 4444: for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) -: 4445: { -: 4446: // XXX rand() % N is not uniformly distributed -: 4447: _RandomAccessIterator __j = __first -: 4448: + std::rand() % ((__i - __first) + 1); -: 4449: if (__i != __j) -: 4450: std::iter_swap(__i, __j); -: 4451: } -: 4452: } -: 4453: -: 4454: /** -: 4455: * @brief Shuffle the elements of a sequence using a random number -: 4456: * generator. -: 4457: * @ingroup mutating_algorithms -: 4458: * @param __first A forward iterator. -: 4459: * @param __last A forward iterator. -: 4460: * @param __rand The RNG functor or function. -: 4461: * @return Nothing. -: 4462: * -: 4463: * Reorders the elements in the range @p [__first,__last) using @p __rand to -: 4464: * provide a random distribution. Calling @p __rand(N) for a positive -: 4465: * integer @p N should return a randomly chosen integer from the -: 4466: * range [0,N). -: 4467: */ -: 4468: template -: 4469: void -: 4470: random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, -: 4471:#if __cplusplus >= 201103L -: 4472: _RandomNumberGenerator&& __rand) -: 4473:#else -: 4474: _RandomNumberGenerator& __rand) -: 4475:#endif -: 4476: { -: 4477: // concept requirements -: 4478: __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< -: 4479: _RandomAccessIterator>) -: 4480: __glibcxx_requires_valid_range(__first, __last); -: 4481: -: 4482: if (__first == __last) -: 4483: return; -: 4484: for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) -: 4485: { -: 4486: _RandomAccessIterator __j = __first + __rand((__i - __first) + 1); -: 4487: if (__i != __j) -: 4488: std::iter_swap(__i, __j); -: 4489: } -: 4490: } -: 4491: -: 4492: -: 4493: /** -: 4494: * @brief Move elements for which a predicate is true to the beginning -: 4495: * of a sequence. -: 4496: * @ingroup mutating_algorithms -: 4497: * @param __first A forward iterator. -: 4498: * @param __last A forward iterator. -: 4499: * @param __pred A predicate functor. -: 4500: * @return An iterator @p middle such that @p __pred(i) is true for each -: 4501: * iterator @p i in the range @p [__first,middle) and false for each @p i -: 4502: * in the range @p [middle,__last). -: 4503: * -: 4504: * @p __pred must not modify its operand. @p partition() does not preserve -: 4505: * the relative ordering of elements in each group, use -: 4506: * @p stable_partition() if this is needed. -: 4507: */ -: 4508: template -: 4509: inline _ForwardIterator -: 4510: partition(_ForwardIterator __first, _ForwardIterator __last, -: 4511: _Predicate __pred) -: 4512: { -: 4513: // concept requirements -: 4514: __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< -: 4515: _ForwardIterator>) -: 4516: __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, -: 4517: typename iterator_traits<_ForwardIterator>::value_type>) -: 4518: __glibcxx_requires_valid_range(__first, __last); -: 4519: -: 4520: return std::__partition(__first, __last, __pred, -: 4521: std::__iterator_category(__first)); -: 4522: } -: 4523: -: 4524: -: 4525: /** -: 4526: * @brief Sort the smallest elements of a sequence. -: 4527: * @ingroup sorting_algorithms -: 4528: * @param __first An iterator. -: 4529: * @param __middle Another iterator. -: 4530: * @param __last Another iterator. -: 4531: * @return Nothing. -: 4532: * -: 4533: * Sorts the smallest @p (__middle-__first) elements in the range -: 4534: * @p [first,last) and moves them to the range @p [__first,__middle). The -: 4535: * order of the remaining elements in the range @p [__middle,__last) is -: 4536: * undefined. -: 4537: * After the sort if @e i and @e j are iterators in the range -: 4538: * @p [__first,__middle) such that i precedes j and @e k is an iterator in -: 4539: * the range @p [__middle,__last) then *j<*i and *k<*i are both false. -: 4540: */ -: 4541: template -: 4542: inline void -: 4543: partial_sort(_RandomAccessIterator __first, -: 4544: _RandomAccessIterator __middle, -: 4545: _RandomAccessIterator __last) -: 4546: { -: 4547: // concept requirements -: 4548: __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< -: 4549: _RandomAccessIterator>) -: 4550: __glibcxx_function_requires(_LessThanComparableConcept< -: 4551: typename iterator_traits<_RandomAccessIterator>::value_type>) -: 4552: __glibcxx_requires_valid_range(__first, __middle); -: 4553: __glibcxx_requires_valid_range(__middle, __last); -: 4554: -: 4555: std::__partial_sort(__first, __middle, __last, -: 4556: __gnu_cxx::__ops::__iter_less_iter()); -: 4557: } -: 4558: -: 4559: /** -: 4560: * @brief Sort the smallest elements of a sequence using a predicate -: 4561: * for comparison. -: 4562: * @ingroup sorting_algorithms -: 4563: * @param __first An iterator. -: 4564: * @param __middle Another iterator. -: 4565: * @param __last Another iterator. -: 4566: * @param __comp A comparison functor. -: 4567: * @return Nothing. -: 4568: * -: 4569: * Sorts the smallest @p (__middle-__first) elements in the range -: 4570: * @p [__first,__last) and moves them to the range @p [__first,__middle). The -: 4571: * order of the remaining elements in the range @p [__middle,__last) is -: 4572: * undefined. -: 4573: * After the sort if @e i and @e j are iterators in the range -: 4574: * @p [__first,__middle) such that i precedes j and @e k is an iterator in -: 4575: * the range @p [__middle,__last) then @p *__comp(j,*i) and @p __comp(*k,*i) -: 4576: * are both false. -: 4577: */ -: 4578: template -: 4579: inline void -: 4580: partial_sort(_RandomAccessIterator __first, -: 4581: _RandomAccessIterator __middle, -: 4582: _RandomAccessIterator __last, -: 4583: _Compare __comp) -: 4584: { -: 4585: // concept requirements -: 4586: __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< -: 4587: _RandomAccessIterator>) -: 4588: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 4589: typename iterator_traits<_RandomAccessIterator>::value_type, -: 4590: typename iterator_traits<_RandomAccessIterator>::value_type>) -: 4591: __glibcxx_requires_valid_range(__first, __middle); -: 4592: __glibcxx_requires_valid_range(__middle, __last); -: 4593: -: 4594: std::__partial_sort(__first, __middle, __last, -: 4595: __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 4596: } -: 4597: -: 4598: /** -: 4599: * @brief Sort a sequence just enough to find a particular position. -: 4600: * @ingroup sorting_algorithms -: 4601: * @param __first An iterator. -: 4602: * @param __nth Another iterator. -: 4603: * @param __last Another iterator. -: 4604: * @return Nothing. -: 4605: * -: 4606: * Rearranges the elements in the range @p [__first,__last) so that @p *__nth -: 4607: * is the same element that would have been in that position had the -: 4608: * whole sequence been sorted. The elements either side of @p *__nth are -: 4609: * not completely sorted, but for any iterator @e i in the range -: 4610: * @p [__first,__nth) and any iterator @e j in the range @p [__nth,__last) it -: 4611: * holds that *j < *i is false. -: 4612: */ -: 4613: template -: 4614: inline void -: 4615: nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, -: 4616: _RandomAccessIterator __last) -: 4617: { -: 4618: // concept requirements -: 4619: __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< -: 4620: _RandomAccessIterator>) -: 4621: __glibcxx_function_requires(_LessThanComparableConcept< -: 4622: typename iterator_traits<_RandomAccessIterator>::value_type>) -: 4623: __glibcxx_requires_valid_range(__first, __nth); -: 4624: __glibcxx_requires_valid_range(__nth, __last); -: 4625: -: 4626: if (__first == __last || __nth == __last) -: 4627: return; -: 4628: -: 4629: std::__introselect(__first, __nth, __last, -: 4630: std::__lg(__last - __first) * 2, -: 4631: __gnu_cxx::__ops::__iter_less_iter()); -: 4632: } -: 4633: -: 4634: /** -: 4635: * @brief Sort a sequence just enough to find a particular position -: 4636: * using a predicate for comparison. -: 4637: * @ingroup sorting_algorithms -: 4638: * @param __first An iterator. -: 4639: * @param __nth Another iterator. -: 4640: * @param __last Another iterator. -: 4641: * @param __comp A comparison functor. -: 4642: * @return Nothing. -: 4643: * -: 4644: * Rearranges the elements in the range @p [__first,__last) so that @p *__nth -: 4645: * is the same element that would have been in that position had the -: 4646: * whole sequence been sorted. The elements either side of @p *__nth are -: 4647: * not completely sorted, but for any iterator @e i in the range -: 4648: * @p [__first,__nth) and any iterator @e j in the range @p [__nth,__last) it -: 4649: * holds that @p __comp(*j,*i) is false. -: 4650: */ -: 4651: template -: 4652: inline void -: 4653: nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, -: 4654: _RandomAccessIterator __last, _Compare __comp) -: 4655: { -: 4656: // concept requirements -: 4657: __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< -: 4658: _RandomAccessIterator>) -: 4659: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 4660: typename iterator_traits<_RandomAccessIterator>::value_type, -: 4661: typename iterator_traits<_RandomAccessIterator>::value_type>) -: 4662: __glibcxx_requires_valid_range(__first, __nth); -: 4663: __glibcxx_requires_valid_range(__nth, __last); -: 4664: -: 4665: if (__first == __last || __nth == __last) -: 4666: return; -: 4667: -: 4668: std::__introselect(__first, __nth, __last, -: 4669: std::__lg(__last - __first) * 2, -: 4670: __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 4671: } -: 4672: -: 4673: /** -: 4674: * @brief Sort the elements of a sequence. -: 4675: * @ingroup sorting_algorithms -: 4676: * @param __first An iterator. -: 4677: * @param __last Another iterator. -: 4678: * @return Nothing. -: 4679: * -: 4680: * Sorts the elements in the range @p [__first,__last) in ascending order, -: 4681: * such that for each iterator @e i in the range @p [__first,__last-1), -: 4682: * *(i+1)<*i is false. -: 4683: * -: 4684: * The relative ordering of equivalent elements is not preserved, use -: 4685: * @p stable_sort() if this is needed. -: 4686: */ -: 4687: template -: 4688: inline void -: 4689: sort(_RandomAccessIterator __first, _RandomAccessIterator __last) -: 4690: { -: 4691: // concept requirements -: 4692: __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< -: 4693: _RandomAccessIterator>) -: 4694: __glibcxx_function_requires(_LessThanComparableConcept< -: 4695: typename iterator_traits<_RandomAccessIterator>::value_type>) -: 4696: __glibcxx_requires_valid_range(__first, __last); -: 4697: -: 4698: std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); -: 4699: } -: 4700: -: 4701: /** -: 4702: * @brief Sort the elements of a sequence using a predicate for comparison. -: 4703: * @ingroup sorting_algorithms -: 4704: * @param __first An iterator. -: 4705: * @param __last Another iterator. -: 4706: * @param __comp A comparison functor. -: 4707: * @return Nothing. -: 4708: * -: 4709: * Sorts the elements in the range @p [__first,__last) in ascending order, -: 4710: * such that @p __comp(*(i+1),*i) is false for every iterator @e i in the -: 4711: * range @p [__first,__last-1). -: 4712: * -: 4713: * The relative ordering of equivalent elements is not preserved, use -: 4714: * @p stable_sort() if this is needed. -: 4715: */ -: 4716: template -: 4717: inline void -: 4718: sort(_RandomAccessIterator __first, _RandomAccessIterator __last, -: 4719: _Compare __comp) -: 4720: { -: 4721: // concept requirements -: 4722: __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< -: 4723: _RandomAccessIterator>) -: 4724: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 4725: typename iterator_traits<_RandomAccessIterator>::value_type, -: 4726: typename iterator_traits<_RandomAccessIterator>::value_type>) -: 4727: __glibcxx_requires_valid_range(__first, __last); -: 4728: -: 4729: std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 4730: } -: 4731: -: 4732: template -: 4734: _OutputIterator -: 4735: __merge(_InputIterator1 __first1, _InputIterator1 __last1, -: 4736: _InputIterator2 __first2, _InputIterator2 __last2, -: 4737: _OutputIterator __result, _Compare __comp) -: 4738: { -: 4739: while (__first1 != __last1 && __first2 != __last2) -: 4740: { -: 4741: if (__comp(__first2, __first1)) -: 4742: { -: 4743: *__result = *__first2; -: 4744: ++__first2; -: 4745: } -: 4746: else -: 4747: { -: 4748: *__result = *__first1; -: 4749: ++__first1; -: 4750: } -: 4751: ++__result; -: 4752: } -: 4753: return std::copy(__first2, __last2, -: 4754: std::copy(__first1, __last1, __result)); -: 4755: } -: 4756: -: 4757: /** -: 4758: * @brief Merges two sorted ranges. -: 4759: * @ingroup sorting_algorithms -: 4760: * @param __first1 An iterator. -: 4761: * @param __first2 Another iterator. -: 4762: * @param __last1 Another iterator. -: 4763: * @param __last2 Another iterator. -: 4764: * @param __result An iterator pointing to the end of the merged range. -: 4765: * @return An iterator pointing to the first element not less -: 4766: * than @e val. -: 4767: * -: 4768: * Merges the ranges @p [__first1,__last1) and @p [__first2,__last2) into -: 4769: * the sorted range @p [__result, __result + (__last1-__first1) + -: 4770: * (__last2-__first2)). Both input ranges must be sorted, and the -: 4771: * output range must not overlap with either of the input ranges. -: 4772: * The sort is @e stable, that is, for equivalent elements in the -: 4773: * two ranges, elements from the first range will always come -: 4774: * before elements from the second. -: 4775: */ -: 4776: template -: 4778: inline _OutputIterator -: 4779: merge(_InputIterator1 __first1, _InputIterator1 __last1, -: 4780: _InputIterator2 __first2, _InputIterator2 __last2, -: 4781: _OutputIterator __result) -: 4782: { -: 4783: // concept requirements -: 4784: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) -: 4785: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) -: 4786: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 4787: typename iterator_traits<_InputIterator1>::value_type>) -: 4788: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 4789: typename iterator_traits<_InputIterator2>::value_type>) -: 4790: __glibcxx_function_requires(_LessThanOpConcept< -: 4791: typename iterator_traits<_InputIterator2>::value_type, -: 4792: typename iterator_traits<_InputIterator1>::value_type>) -: 4793: __glibcxx_requires_sorted_set(__first1, __last1, __first2); -: 4794: __glibcxx_requires_sorted_set(__first2, __last2, __first1); -: 4795: -: 4796: return _GLIBCXX_STD_A::__merge(__first1, __last1, -: 4797: __first2, __last2, __result, -: 4798: __gnu_cxx::__ops::__iter_less_iter()); -: 4799: } -: 4800: -: 4801: /** -: 4802: * @brief Merges two sorted ranges. -: 4803: * @ingroup sorting_algorithms -: 4804: * @param __first1 An iterator. -: 4805: * @param __first2 Another iterator. -: 4806: * @param __last1 Another iterator. -: 4807: * @param __last2 Another iterator. -: 4808: * @param __result An iterator pointing to the end of the merged range. -: 4809: * @param __comp A functor to use for comparisons. -: 4810: * @return An iterator pointing to the first element "not less -: 4811: * than" @e val. -: 4812: * -: 4813: * Merges the ranges @p [__first1,__last1) and @p [__first2,__last2) into -: 4814: * the sorted range @p [__result, __result + (__last1-__first1) + -: 4815: * (__last2-__first2)). Both input ranges must be sorted, and the -: 4816: * output range must not overlap with either of the input ranges. -: 4817: * The sort is @e stable, that is, for equivalent elements in the -: 4818: * two ranges, elements from the first range will always come -: 4819: * before elements from the second. -: 4820: * -: 4821: * The comparison function should have the same effects on ordering as -: 4822: * the function used for the initial sort. -: 4823: */ -: 4824: template -: 4826: inline _OutputIterator -: 4827: merge(_InputIterator1 __first1, _InputIterator1 __last1, -: 4828: _InputIterator2 __first2, _InputIterator2 __last2, -: 4829: _OutputIterator __result, _Compare __comp) -: 4830: { -: 4831: // concept requirements -: 4832: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) -: 4833: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) -: 4834: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 4835: typename iterator_traits<_InputIterator1>::value_type>) -: 4836: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 4837: typename iterator_traits<_InputIterator2>::value_type>) -: 4838: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 4839: typename iterator_traits<_InputIterator2>::value_type, -: 4840: typename iterator_traits<_InputIterator1>::value_type>) -: 4841: __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); -: 4842: __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); -: 4843: -: 4844: return _GLIBCXX_STD_A::__merge(__first1, __last1, -: 4845: __first2, __last2, __result, -: 4846: __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 4847: } -: 4848: -: 4849: template -: 4850: inline void -: 4851: __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, -: 4852: _Compare __comp) -: 4853: { -: 4854: typedef typename iterator_traits<_RandomAccessIterator>::value_type -: 4855: _ValueType; -: 4856: typedef typename iterator_traits<_RandomAccessIterator>::difference_type -: 4857: _DistanceType; -: 4858: -: 4859: typedef _Temporary_buffer<_RandomAccessIterator, _ValueType> _TmpBuf; -: 4860: _TmpBuf __buf(__first, __last); -: 4861: -: 4862: if (__buf.begin() == 0) -: 4863: std::__inplace_stable_sort(__first, __last, __comp); -: 4864: else -: 4865: std::__stable_sort_adaptive(__first, __last, __buf.begin(), -: 4866: _DistanceType(__buf.size()), __comp); -: 4867: } -: 4868: -: 4869: /** -: 4870: * @brief Sort the elements of a sequence, preserving the relative order -: 4871: * of equivalent elements. -: 4872: * @ingroup sorting_algorithms -: 4873: * @param __first An iterator. -: 4874: * @param __last Another iterator. -: 4875: * @return Nothing. -: 4876: * -: 4877: * Sorts the elements in the range @p [__first,__last) in ascending order, -: 4878: * such that for each iterator @p i in the range @p [__first,__last-1), -: 4879: * @p *(i+1)<*i is false. -: 4880: * -: 4881: * The relative ordering of equivalent elements is preserved, so any two -: 4882: * elements @p x and @p y in the range @p [__first,__last) such that -: 4883: * @p x -: 4887: inline void -: 4888: stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last) -: 4889: { -: 4890: // concept requirements -: 4891: __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< -: 4892: _RandomAccessIterator>) -: 4893: __glibcxx_function_requires(_LessThanComparableConcept< -: 4894: typename iterator_traits<_RandomAccessIterator>::value_type>) -: 4895: __glibcxx_requires_valid_range(__first, __last); -: 4896: -: 4897: _GLIBCXX_STD_A::__stable_sort(__first, __last, -: 4898: __gnu_cxx::__ops::__iter_less_iter()); -: 4899: } -: 4900: -: 4901: /** -: 4902: * @brief Sort the elements of a sequence using a predicate for comparison, -: 4903: * preserving the relative order of equivalent elements. -: 4904: * @ingroup sorting_algorithms -: 4905: * @param __first An iterator. -: 4906: * @param __last Another iterator. -: 4907: * @param __comp A comparison functor. -: 4908: * @return Nothing. -: 4909: * -: 4910: * Sorts the elements in the range @p [__first,__last) in ascending order, -: 4911: * such that for each iterator @p i in the range @p [__first,__last-1), -: 4912: * @p __comp(*(i+1),*i) is false. -: 4913: * -: 4914: * The relative ordering of equivalent elements is preserved, so any two -: 4915: * elements @p x and @p y in the range @p [__first,__last) such that -: 4916: * @p __comp(x,y) is false and @p __comp(y,x) is false will have the same -: 4917: * relative ordering after calling @p stable_sort(). -: 4918: */ -: 4919: template -: 4920: inline void -: 4921: stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, -: 4922: _Compare __comp) -: 4923: { -: 4924: // concept requirements -: 4925: __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< -: 4926: _RandomAccessIterator>) -: 4927: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 4928: typename iterator_traits<_RandomAccessIterator>::value_type, -: 4929: typename iterator_traits<_RandomAccessIterator>::value_type>) -: 4930: __glibcxx_requires_valid_range(__first, __last); -: 4931: -: 4932: _GLIBCXX_STD_A::__stable_sort(__first, __last, -: 4933: __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 4934: } -: 4935: -: 4936: template -: 4939: _OutputIterator -: 4940: __set_union(_InputIterator1 __first1, _InputIterator1 __last1, -: 4941: _InputIterator2 __first2, _InputIterator2 __last2, -: 4942: _OutputIterator __result, _Compare __comp) -: 4943: { -: 4944: while (__first1 != __last1 && __first2 != __last2) -: 4945: { -: 4946: if (__comp(__first1, __first2)) -: 4947: { -: 4948: *__result = *__first1; -: 4949: ++__first1; -: 4950: } -: 4951: else if (__comp(__first2, __first1)) -: 4952: { -: 4953: *__result = *__first2; -: 4954: ++__first2; -: 4955: } -: 4956: else -: 4957: { -: 4958: *__result = *__first1; -: 4959: ++__first1; -: 4960: ++__first2; -: 4961: } -: 4962: ++__result; -: 4963: } -: 4964: return std::copy(__first2, __last2, -: 4965: std::copy(__first1, __last1, __result)); -: 4966: } -: 4967: -: 4968: /** -: 4969: * @brief Return the union of two sorted ranges. -: 4970: * @ingroup set_algorithms -: 4971: * @param __first1 Start of first range. -: 4972: * @param __last1 End of first range. -: 4973: * @param __first2 Start of second range. -: 4974: * @param __last2 End of second range. -: 4975: * @return End of the output range. -: 4976: * @ingroup set_algorithms -: 4977: * -: 4978: * This operation iterates over both ranges, copying elements present in -: 4979: * each range in order to the output range. Iterators increment for each -: 4980: * range. When the current element of one range is less than the other, -: 4981: * that element is copied and the iterator advanced. If an element is -: 4982: * contained in both ranges, the element from the first range is copied and -: 4983: * both ranges advance. The output range may not overlap either input -: 4984: * range. -: 4985: */ -: 4986: template -: 4988: inline _OutputIterator -: 4989: set_union(_InputIterator1 __first1, _InputIterator1 __last1, -: 4990: _InputIterator2 __first2, _InputIterator2 __last2, -: 4991: _OutputIterator __result) -: 4992: { -: 4993: // concept requirements -: 4994: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) -: 4995: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) -: 4996: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 4997: typename iterator_traits<_InputIterator1>::value_type>) -: 4998: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 4999: typename iterator_traits<_InputIterator2>::value_type>) -: 5000: __glibcxx_function_requires(_LessThanOpConcept< -: 5001: typename iterator_traits<_InputIterator1>::value_type, -: 5002: typename iterator_traits<_InputIterator2>::value_type>) -: 5003: __glibcxx_function_requires(_LessThanOpConcept< -: 5004: typename iterator_traits<_InputIterator2>::value_type, -: 5005: typename iterator_traits<_InputIterator1>::value_type>) -: 5006: __glibcxx_requires_sorted_set(__first1, __last1, __first2); -: 5007: __glibcxx_requires_sorted_set(__first2, __last2, __first1); -: 5008: -: 5009: return _GLIBCXX_STD_A::__set_union(__first1, __last1, -: 5010: __first2, __last2, __result, -: 5011: __gnu_cxx::__ops::__iter_less_iter()); -: 5012: } -: 5013: -: 5014: /** -: 5015: * @brief Return the union of two sorted ranges using a comparison functor. -: 5016: * @ingroup set_algorithms -: 5017: * @param __first1 Start of first range. -: 5018: * @param __last1 End of first range. -: 5019: * @param __first2 Start of second range. -: 5020: * @param __last2 End of second range. -: 5021: * @param __comp The comparison functor. -: 5022: * @return End of the output range. -: 5023: * @ingroup set_algorithms -: 5024: * -: 5025: * This operation iterates over both ranges, copying elements present in -: 5026: * each range in order to the output range. Iterators increment for each -: 5027: * range. When the current element of one range is less than the other -: 5028: * according to @p __comp, that element is copied and the iterator advanced. -: 5029: * If an equivalent element according to @p __comp is contained in both -: 5030: * ranges, the element from the first range is copied and both ranges -: 5031: * advance. The output range may not overlap either input range. -: 5032: */ -: 5033: template -: 5035: inline _OutputIterator -: 5036: set_union(_InputIterator1 __first1, _InputIterator1 __last1, -: 5037: _InputIterator2 __first2, _InputIterator2 __last2, -: 5038: _OutputIterator __result, _Compare __comp) -: 5039: { -: 5040: // concept requirements -: 5041: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) -: 5042: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) -: 5043: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 5044: typename iterator_traits<_InputIterator1>::value_type>) -: 5045: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 5046: typename iterator_traits<_InputIterator2>::value_type>) -: 5047: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 5048: typename iterator_traits<_InputIterator1>::value_type, -: 5049: typename iterator_traits<_InputIterator2>::value_type>) -: 5050: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 5051: typename iterator_traits<_InputIterator2>::value_type, -: 5052: typename iterator_traits<_InputIterator1>::value_type>) -: 5053: __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); -: 5054: __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); -: 5055: -: 5056: return _GLIBCXX_STD_A::__set_union(__first1, __last1, -: 5057: __first2, __last2, __result, -: 5058: __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 5059: } -: 5060: -: 5061: template -: 5064: _OutputIterator -: 5065: __set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, -: 5066: _InputIterator2 __first2, _InputIterator2 __last2, -: 5067: _OutputIterator __result, _Compare __comp) -: 5068: { -: 5069: while (__first1 != __last1 && __first2 != __last2) -: 5070: if (__comp(__first1, __first2)) -: 5071: ++__first1; -: 5072: else if (__comp(__first2, __first1)) -: 5073: ++__first2; -: 5074: else -: 5075: { -: 5076: *__result = *__first1; -: 5077: ++__first1; -: 5078: ++__first2; -: 5079: ++__result; -: 5080: } -: 5081: return __result; -: 5082: } -: 5083: -: 5084: /** -: 5085: * @brief Return the intersection of two sorted ranges. -: 5086: * @ingroup set_algorithms -: 5087: * @param __first1 Start of first range. -: 5088: * @param __last1 End of first range. -: 5089: * @param __first2 Start of second range. -: 5090: * @param __last2 End of second range. -: 5091: * @return End of the output range. -: 5092: * @ingroup set_algorithms -: 5093: * -: 5094: * This operation iterates over both ranges, copying elements present in -: 5095: * both ranges in order to the output range. Iterators increment for each -: 5096: * range. When the current element of one range is less than the other, -: 5097: * that iterator advances. If an element is contained in both ranges, the -: 5098: * element from the first range is copied and both ranges advance. The -: 5099: * output range may not overlap either input range. -: 5100: */ -: 5101: template -: 5103: inline _OutputIterator -: 5104: set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, -: 5105: _InputIterator2 __first2, _InputIterator2 __last2, -: 5106: _OutputIterator __result) -: 5107: { -: 5108: // concept requirements -: 5109: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) -: 5110: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) -: 5111: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 5112: typename iterator_traits<_InputIterator1>::value_type>) -: 5113: __glibcxx_function_requires(_LessThanOpConcept< -: 5114: typename iterator_traits<_InputIterator1>::value_type, -: 5115: typename iterator_traits<_InputIterator2>::value_type>) -: 5116: __glibcxx_function_requires(_LessThanOpConcept< -: 5117: typename iterator_traits<_InputIterator2>::value_type, -: 5118: typename iterator_traits<_InputIterator1>::value_type>) -: 5119: __glibcxx_requires_sorted_set(__first1, __last1, __first2); -: 5120: __glibcxx_requires_sorted_set(__first2, __last2, __first1); -: 5121: -: 5122: return _GLIBCXX_STD_A::__set_intersection(__first1, __last1, -: 5123: __first2, __last2, __result, -: 5124: __gnu_cxx::__ops::__iter_less_iter()); -: 5125: } -: 5126: -: 5127: /** -: 5128: * @brief Return the intersection of two sorted ranges using comparison -: 5129: * functor. -: 5130: * @ingroup set_algorithms -: 5131: * @param __first1 Start of first range. -: 5132: * @param __last1 End of first range. -: 5133: * @param __first2 Start of second range. -: 5134: * @param __last2 End of second range. -: 5135: * @param __comp The comparison functor. -: 5136: * @return End of the output range. -: 5137: * @ingroup set_algorithms -: 5138: * -: 5139: * This operation iterates over both ranges, copying elements present in -: 5140: * both ranges in order to the output range. Iterators increment for each -: 5141: * range. When the current element of one range is less than the other -: 5142: * according to @p __comp, that iterator advances. If an element is -: 5143: * contained in both ranges according to @p __comp, the element from the -: 5144: * first range is copied and both ranges advance. The output range may not -: 5145: * overlap either input range. -: 5146: */ -: 5147: template -: 5149: inline _OutputIterator -: 5150: set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, -: 5151: _InputIterator2 __first2, _InputIterator2 __last2, -: 5152: _OutputIterator __result, _Compare __comp) -: 5153: { -: 5154: // concept requirements -: 5155: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) -: 5156: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) -: 5157: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 5158: typename iterator_traits<_InputIterator1>::value_type>) -: 5159: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 5160: typename iterator_traits<_InputIterator1>::value_type, -: 5161: typename iterator_traits<_InputIterator2>::value_type>) -: 5162: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 5163: typename iterator_traits<_InputIterator2>::value_type, -: 5164: typename iterator_traits<_InputIterator1>::value_type>) -: 5165: __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); -: 5166: __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); -: 5167: -: 5168: return _GLIBCXX_STD_A::__set_intersection(__first1, __last1, -: 5169: __first2, __last2, __result, -: 5170: __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 5171: } -: 5172: -: 5173: template -: 5176: _OutputIterator -: 5177: __set_difference(_InputIterator1 __first1, _InputIterator1 __last1, -: 5178: _InputIterator2 __first2, _InputIterator2 __last2, -: 5179: _OutputIterator __result, _Compare __comp) -: 5180: { -: 5181: while (__first1 != __last1 && __first2 != __last2) -: 5182: if (__comp(__first1, __first2)) -: 5183: { -: 5184: *__result = *__first1; -: 5185: ++__first1; -: 5186: ++__result; -: 5187: } -: 5188: else if (__comp(__first2, __first1)) -: 5189: ++__first2; -: 5190: else -: 5191: { -: 5192: ++__first1; -: 5193: ++__first2; -: 5194: } -: 5195: return std::copy(__first1, __last1, __result); -: 5196: } -: 5197: -: 5198: /** -: 5199: * @brief Return the difference of two sorted ranges. -: 5200: * @ingroup set_algorithms -: 5201: * @param __first1 Start of first range. -: 5202: * @param __last1 End of first range. -: 5203: * @param __first2 Start of second range. -: 5204: * @param __last2 End of second range. -: 5205: * @return End of the output range. -: 5206: * @ingroup set_algorithms -: 5207: * -: 5208: * This operation iterates over both ranges, copying elements present in -: 5209: * the first range but not the second in order to the output range. -: 5210: * Iterators increment for each range. When the current element of the -: 5211: * first range is less than the second, that element is copied and the -: 5212: * iterator advances. If the current element of the second range is less, -: 5213: * the iterator advances, but no element is copied. If an element is -: 5214: * contained in both ranges, no elements are copied and both ranges -: 5215: * advance. The output range may not overlap either input range. -: 5216: */ -: 5217: template -: 5219: inline _OutputIterator -: 5220: set_difference(_InputIterator1 __first1, _InputIterator1 __last1, -: 5221: _InputIterator2 __first2, _InputIterator2 __last2, -: 5222: _OutputIterator __result) -: 5223: { -: 5224: // concept requirements -: 5225: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) -: 5226: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) -: 5227: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 5228: typename iterator_traits<_InputIterator1>::value_type>) -: 5229: __glibcxx_function_requires(_LessThanOpConcept< -: 5230: typename iterator_traits<_InputIterator1>::value_type, -: 5231: typename iterator_traits<_InputIterator2>::value_type>) -: 5232: __glibcxx_function_requires(_LessThanOpConcept< -: 5233: typename iterator_traits<_InputIterator2>::value_type, -: 5234: typename iterator_traits<_InputIterator1>::value_type>) -: 5235: __glibcxx_requires_sorted_set(__first1, __last1, __first2); -: 5236: __glibcxx_requires_sorted_set(__first2, __last2, __first1); -: 5237: -: 5238: return _GLIBCXX_STD_A::__set_difference(__first1, __last1, -: 5239: __first2, __last2, __result, -: 5240: __gnu_cxx::__ops::__iter_less_iter()); -: 5241: } -: 5242: -: 5243: /** -: 5244: * @brief Return the difference of two sorted ranges using comparison -: 5245: * functor. -: 5246: * @ingroup set_algorithms -: 5247: * @param __first1 Start of first range. -: 5248: * @param __last1 End of first range. -: 5249: * @param __first2 Start of second range. -: 5250: * @param __last2 End of second range. -: 5251: * @param __comp The comparison functor. -: 5252: * @return End of the output range. -: 5253: * @ingroup set_algorithms -: 5254: * -: 5255: * This operation iterates over both ranges, copying elements present in -: 5256: * the first range but not the second in order to the output range. -: 5257: * Iterators increment for each range. When the current element of the -: 5258: * first range is less than the second according to @p __comp, that element -: 5259: * is copied and the iterator advances. If the current element of the -: 5260: * second range is less, no element is copied and the iterator advances. -: 5261: * If an element is contained in both ranges according to @p __comp, no -: 5262: * elements are copied and both ranges advance. The output range may not -: 5263: * overlap either input range. -: 5264: */ -: 5265: template -: 5267: inline _OutputIterator -: 5268: set_difference(_InputIterator1 __first1, _InputIterator1 __last1, -: 5269: _InputIterator2 __first2, _InputIterator2 __last2, -: 5270: _OutputIterator __result, _Compare __comp) -: 5271: { -: 5272: // concept requirements -: 5273: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) -: 5274: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) -: 5275: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 5276: typename iterator_traits<_InputIterator1>::value_type>) -: 5277: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 5278: typename iterator_traits<_InputIterator1>::value_type, -: 5279: typename iterator_traits<_InputIterator2>::value_type>) -: 5280: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 5281: typename iterator_traits<_InputIterator2>::value_type, -: 5282: typename iterator_traits<_InputIterator1>::value_type>) -: 5283: __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); -: 5284: __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); -: 5285: -: 5286: return _GLIBCXX_STD_A::__set_difference(__first1, __last1, -: 5287: __first2, __last2, __result, -: 5288: __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 5289: } -: 5290: -: 5291: template -: 5294: _OutputIterator -: 5295: __set_symmetric_difference(_InputIterator1 __first1, -: 5296: _InputIterator1 __last1, -: 5297: _InputIterator2 __first2, -: 5298: _InputIterator2 __last2, -: 5299: _OutputIterator __result, -: 5300: _Compare __comp) -: 5301: { -: 5302: while (__first1 != __last1 && __first2 != __last2) -: 5303: if (__comp(__first1, __first2)) -: 5304: { -: 5305: *__result = *__first1; -: 5306: ++__first1; -: 5307: ++__result; -: 5308: } -: 5309: else if (__comp(__first2, __first1)) -: 5310: { -: 5311: *__result = *__first2; -: 5312: ++__first2; -: 5313: ++__result; -: 5314: } -: 5315: else -: 5316: { -: 5317: ++__first1; -: 5318: ++__first2; -: 5319: } -: 5320: return std::copy(__first2, __last2, -: 5321: std::copy(__first1, __last1, __result)); -: 5322: } -: 5323: -: 5324: /** -: 5325: * @brief Return the symmetric difference of two sorted ranges. -: 5326: * @ingroup set_algorithms -: 5327: * @param __first1 Start of first range. -: 5328: * @param __last1 End of first range. -: 5329: * @param __first2 Start of second range. -: 5330: * @param __last2 End of second range. -: 5331: * @return End of the output range. -: 5332: * @ingroup set_algorithms -: 5333: * -: 5334: * This operation iterates over both ranges, copying elements present in -: 5335: * one range but not the other in order to the output range. Iterators -: 5336: * increment for each range. When the current element of one range is less -: 5337: * than the other, that element is copied and the iterator advances. If an -: 5338: * element is contained in both ranges, no elements are copied and both -: 5339: * ranges advance. The output range may not overlap either input range. -: 5340: */ -: 5341: template -: 5343: inline _OutputIterator -: 5344: set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, -: 5345: _InputIterator2 __first2, _InputIterator2 __last2, -: 5346: _OutputIterator __result) -: 5347: { -: 5348: // concept requirements -: 5349: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) -: 5350: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) -: 5351: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 5352: typename iterator_traits<_InputIterator1>::value_type>) -: 5353: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 5354: typename iterator_traits<_InputIterator2>::value_type>) -: 5355: __glibcxx_function_requires(_LessThanOpConcept< -: 5356: typename iterator_traits<_InputIterator1>::value_type, -: 5357: typename iterator_traits<_InputIterator2>::value_type>) -: 5358: __glibcxx_function_requires(_LessThanOpConcept< -: 5359: typename iterator_traits<_InputIterator2>::value_type, -: 5360: typename iterator_traits<_InputIterator1>::value_type>) -: 5361: __glibcxx_requires_sorted_set(__first1, __last1, __first2); -: 5362: __glibcxx_requires_sorted_set(__first2, __last2, __first1); -: 5363: -: 5364: return _GLIBCXX_STD_A::__set_symmetric_difference(__first1, __last1, -: 5365: __first2, __last2, __result, -: 5366: __gnu_cxx::__ops::__iter_less_iter()); -: 5367: } -: 5368: -: 5369: /** -: 5370: * @brief Return the symmetric difference of two sorted ranges using -: 5371: * comparison functor. -: 5372: * @ingroup set_algorithms -: 5373: * @param __first1 Start of first range. -: 5374: * @param __last1 End of first range. -: 5375: * @param __first2 Start of second range. -: 5376: * @param __last2 End of second range. -: 5377: * @param __comp The comparison functor. -: 5378: * @return End of the output range. -: 5379: * @ingroup set_algorithms -: 5380: * -: 5381: * This operation iterates over both ranges, copying elements present in -: 5382: * one range but not the other in order to the output range. Iterators -: 5383: * increment for each range. When the current element of one range is less -: 5384: * than the other according to @p comp, that element is copied and the -: 5385: * iterator advances. If an element is contained in both ranges according -: 5386: * to @p __comp, no elements are copied and both ranges advance. The output -: 5387: * range may not overlap either input range. -: 5388: */ -: 5389: template -: 5391: inline _OutputIterator -: 5392: set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, -: 5393: _InputIterator2 __first2, _InputIterator2 __last2, -: 5394: _OutputIterator __result, -: 5395: _Compare __comp) -: 5396: { -: 5397: // concept requirements -: 5398: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) -: 5399: __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) -: 5400: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 5401: typename iterator_traits<_InputIterator1>::value_type>) -: 5402: __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, -: 5403: typename iterator_traits<_InputIterator2>::value_type>) -: 5404: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 5405: typename iterator_traits<_InputIterator1>::value_type, -: 5406: typename iterator_traits<_InputIterator2>::value_type>) -: 5407: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 5408: typename iterator_traits<_InputIterator2>::value_type, -: 5409: typename iterator_traits<_InputIterator1>::value_type>) -: 5410: __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); -: 5411: __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); -: 5412: -: 5413: return _GLIBCXX_STD_A::__set_symmetric_difference(__first1, __last1, -: 5414: __first2, __last2, __result, -: 5415: __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 5416: } -: 5417: -: 5418: template -: 5419: _GLIBCXX14_CONSTEXPR -: 5420: _ForwardIterator -: 5421: __min_element(_ForwardIterator __first, _ForwardIterator __last, -: 5422: _Compare __comp) -: 5423: { -: 5424: if (__first == __last) -: 5425: return __first; -: 5426: _ForwardIterator __result = __first; -: 5427: while (++__first != __last) -: 5428: if (__comp(__first, __result)) -: 5429: __result = __first; -: 5430: return __result; -: 5431: } -: 5432: -: 5433: /** -: 5434: * @brief Return the minimum element in a range. -: 5435: * @ingroup sorting_algorithms -: 5436: * @param __first Start of range. -: 5437: * @param __last End of range. -: 5438: * @return Iterator referencing the first instance of the smallest value. -: 5439: */ -: 5440: template -: 5441: _GLIBCXX14_CONSTEXPR -: 5442: _ForwardIterator -: 5443: inline min_element(_ForwardIterator __first, _ForwardIterator __last) -: 5444: { -: 5445: // concept requirements -: 5446: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 5447: __glibcxx_function_requires(_LessThanComparableConcept< -: 5448: typename iterator_traits<_ForwardIterator>::value_type>) -: 5449: __glibcxx_requires_valid_range(__first, __last); -: 5450: -: 5451: return _GLIBCXX_STD_A::__min_element(__first, __last, -: 5452: __gnu_cxx::__ops::__iter_less_iter()); -: 5453: } -: 5454: -: 5455: /** -: 5456: * @brief Return the minimum element in a range using comparison functor. -: 5457: * @ingroup sorting_algorithms -: 5458: * @param __first Start of range. -: 5459: * @param __last End of range. -: 5460: * @param __comp Comparison functor. -: 5461: * @return Iterator referencing the first instance of the smallest value -: 5462: * according to __comp. -: 5463: */ -: 5464: template -: 5465: _GLIBCXX14_CONSTEXPR -: 5466: inline _ForwardIterator -: 5467: min_element(_ForwardIterator __first, _ForwardIterator __last, -: 5468: _Compare __comp) -: 5469: { -: 5470: // concept requirements -: 5471: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 5472: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 5473: typename iterator_traits<_ForwardIterator>::value_type, -: 5474: typename iterator_traits<_ForwardIterator>::value_type>) -: 5475: __glibcxx_requires_valid_range(__first, __last); -: 5476: -: 5477: return _GLIBCXX_STD_A::__min_element(__first, __last, -: 5478: __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 5479: } -: 5480: -: 5481: template -: 5482: _GLIBCXX14_CONSTEXPR -: 5483: _ForwardIterator -: 5484: __max_element(_ForwardIterator __first, _ForwardIterator __last, -: 5485: _Compare __comp) -: 5486: { -: 5487: if (__first == __last) return __first; -: 5488: _ForwardIterator __result = __first; -: 5489: while (++__first != __last) -: 5490: if (__comp(__result, __first)) -: 5491: __result = __first; -: 5492: return __result; -: 5493: } -: 5494: -: 5495: /** -: 5496: * @brief Return the maximum element in a range. -: 5497: * @ingroup sorting_algorithms -: 5498: * @param __first Start of range. -: 5499: * @param __last End of range. -: 5500: * @return Iterator referencing the first instance of the largest value. -: 5501: */ -: 5502: template -: 5503: _GLIBCXX14_CONSTEXPR -: 5504: inline _ForwardIterator -: 5505: max_element(_ForwardIterator __first, _ForwardIterator __last) -: 5506: { -: 5507: // concept requirements -: 5508: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 5509: __glibcxx_function_requires(_LessThanComparableConcept< -: 5510: typename iterator_traits<_ForwardIterator>::value_type>) -: 5511: __glibcxx_requires_valid_range(__first, __last); -: 5512: -: 5513: return _GLIBCXX_STD_A::__max_element(__first, __last, -: 5514: __gnu_cxx::__ops::__iter_less_iter()); -: 5515: } -: 5516: -: 5517: /** -: 5518: * @brief Return the maximum element in a range using comparison functor. -: 5519: * @ingroup sorting_algorithms -: 5520: * @param __first Start of range. -: 5521: * @param __last End of range. -: 5522: * @param __comp Comparison functor. -: 5523: * @return Iterator referencing the first instance of the largest value -: 5524: * according to __comp. -: 5525: */ -: 5526: template -: 5527: _GLIBCXX14_CONSTEXPR -: 5528: inline _ForwardIterator -: 5529: max_element(_ForwardIterator __first, _ForwardIterator __last, -: 5530: _Compare __comp) -: 5531: { -: 5532: // concept requirements -: 5533: __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) -: 5534: __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, -: 5535: typename iterator_traits<_ForwardIterator>::value_type, -: 5536: typename iterator_traits<_ForwardIterator>::value_type>) -: 5537: __glibcxx_requires_valid_range(__first, __last); -: 5538: -: 5539: return _GLIBCXX_STD_A::__max_element(__first, __last, -: 5540: __gnu_cxx::__ops::__iter_comp_iter(__comp)); -: 5541: } -: 5542: -: 5543:_GLIBCXX_END_NAMESPACE_ALGO -: 5544:} // namespace std -: 5545: -: 5546:#endif /* _STL_ALGO_H */ <<<<<< EOF # path=/home/travis/build/richelbilderbeek/AminoAcidFighter/#usr#include#c++#5#bits#stl_uninitialized.h.gcov -: 0:Source:/usr/include/c++/5/bits/stl_uninitialized.h -: 0:Programs:19 -: 1:// Raw memory manipulators -*- C++ -*- -: 2: -: 3:// Copyright (C) 2001-2015 Free Software Foundation, Inc. -: 4:// -: 5:// This file is part of the GNU ISO C++ Library. This library is free -: 6:// software; you can redistribute it and/or modify it under the -: 7:// terms of the GNU General Public License as published by the -: 8:// Free Software Foundation; either version 3, or (at your option) -: 9:// any later version. -: 10: -: 11:// This library is distributed in the hope that it will be useful, -: 12:// but WITHOUT ANY WARRANTY; without even the implied warranty of -: 13:// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -: 14:// GNU General Public License for more details. -: 15: -: 16:// Under Section 7 of GPL version 3, you are granted additional -: 17:// permissions described in the GCC Runtime Library Exception, version -: 18:// 3.1, as published by the Free Software Foundation. -: 19: -: 20:// You should have received a copy of the GNU General Public License and -: 21:// a copy of the GCC Runtime Library Exception along with this program; -: 22:// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -: 23:// . -: 24: -: 25:/* -: 26: * -: 27: * Copyright (c) 1994 -: 28: * Hewlett-Packard Company -: 29: * -: 30: * Permission to use, copy, modify, distribute and sell this software -: 31: * and its documentation for any purpose is hereby granted without fee, -: 32: * provided that the above copyright notice appear in all copies and -: 33: * that both that copyright notice and this permission notice appear -: 34: * in supporting documentation. Hewlett-Packard Company makes no -: 35: * representations about the suitability of this software for any -: 36: * purpose. It is provided "as is" without express or implied warranty. -: 37: * -: 38: * -: 39: * Copyright (c) 1996,1997 -: 40: * Silicon Graphics Computer Systems, Inc. -: 41: * -: 42: * Permission to use, copy, modify, distribute and sell this software -: 43: * and its documentation for any purpose is hereby granted without fee, -: 44: * provided that the above copyright notice appear in all copies and -: 45: * that both that copyright notice and this permission notice appear -: 46: * in supporting documentation. Silicon Graphics makes no -: 47: * representations about the suitability of this software for any -: 48: * purpose. It is provided "as is" without express or implied warranty. -: 49: */ -: 50: -: 51:/** @file bits/stl_uninitialized.h -: 52: * This is an internal header file, included by other library headers. -: 53: * Do not attempt to use it directly. @headername{memory} -: 54: */ -: 55: -: 56:#ifndef _STL_UNINITIALIZED_H -: 57:#define _STL_UNINITIALIZED_H 1 -: 58: -: 59:namespace std _GLIBCXX_VISIBILITY(default) -: 60:{ -: 61:_GLIBCXX_BEGIN_NAMESPACE_VERSION -: 62: -: 63: template -: 64: struct __uninitialized_copy -: 65: { -: 66: template -: 67: static _ForwardIterator function _ZNSt20__uninitialized_copyILb0EE13__uninit_copyIN9__gnu_cxx17__normal_iteratorIPK6bulletSt6vectorIS4_SaIS4_EEEEPS4_EET0_T_SD_SC_ called 12 returned 100% blocks executed 100% function _ZNSt20__uninitialized_copyILb0EE13__uninit_copyISt13move_iteratorIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEES9_EET0_T_SC_SB_ called 6 returned 100% blocks executed 72% function _ZNSt20__uninitialized_copyILb0EE13__uninit_copyIPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPS7_EET0_T_SC_SB_ called 2 returned 100% blocks executed 67% function _ZNSt20__uninitialized_copyILb0EE13__uninit_copyIPK6bulletPS2_EET0_T_S7_S6_ called 2 returned 100% blocks executed 100% function _ZNSt20__uninitialized_copyILb0EE13__uninit_copyISt13move_iteratorIP6bulletES4_EET0_T_S7_S6_ called 8 returned 100% blocks executed 72% function _ZNSt20__uninitialized_copyILb0EE13__uninit_copyISt13move_iteratorIP6playerES4_EET0_T_S7_S6_ called 45 returned 100% blocks executed 72% function _ZNSt20__uninitialized_copyILb0EE13__uninit_copyIN9__gnu_cxx17__normal_iteratorIPK6playerSt6vectorIS4_SaIS4_EEEEPS4_EET0_T_SD_SC_ called 0 returned 0% blocks executed 0% function _ZNSt20__uninitialized_copyILb0EE13__uninit_copyISt13move_iteratorIP6bulletES4_EET0_T_S7_S6_ called 0 returned 0% blocks executed 0% function _ZNSt20__uninitialized_copyILb0EE13__uninit_copyIN9__gnu_cxx17__normal_iteratorIPK6bulletSt6vectorIS4_SaIS4_EEEEPS4_EET0_T_SD_SC_ called 0 returned 0% blocks executed 0% function _ZNSt20__uninitialized_copyILb0EE13__uninit_copyIP6bulletS3_EET0_T_S5_S4_ called 0 returned 0% blocks executed 0% 75: 68: __uninit_copy(_InputIterator __first, _InputIterator __last, -: 69: _ForwardIterator __result) -: 70: { 75: 71: _ForwardIterator __cur = __result; -: 72: __try -: 73: { 219: 74: for (; __first != __last; ++__first, ++__cur) call 0 returned 100% branch 1 taken 40% (fallthrough) branch 2 taken 60% call 3 returned 100% call 4 returned 100% branch 5 taken 100% (fallthrough) branch 6 taken 0% (throw) branch 7 taken 84% (fallthrough) branch 8 taken 16% call 9 returned 100% branch 10 taken 50% (fallthrough) branch 11 taken 50% branch 12 taken 71% (fallthrough) branch 13 taken 29% call 14 returned 100% branch 15 taken 100% (fallthrough) branch 16 taken 0% (throw) branch 17 taken 20% (fallthrough) branch 18 taken 80% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) branch 23 taken 35% (fallthrough) branch 24 taken 65% call 25 returned 100% call 26 never executed branch 27 never executed branch 28 never executed call 29 never executed call 30 never executed branch 31 never executed branch 32 never executed branch 33 never executed branch 34 never executed call 35 never executed call 36 never executed branch 37 never executed branch 38 never executed call 39 never executed branch 40 never executed branch 41 never executed 72: 75: std::_Construct(std::__addressof(*__cur), *__first); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% call 6 returned 100% call 7 returned 100% call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% call 12 returned 100% call 13 returned 100% branch 14 taken 100% (fallthrough) branch 15 taken 0% (throw) call 16 returned 100% call 17 returned 100% call 18 returned 100% call 19 returned 100% call 20 returned 100% call 21 returned 100% call 22 returned 100% call 23 returned 100% call 24 returned 100% call 25 returned 100% call 26 returned 100% call 27 returned 100% call 28 returned 100% call 29 returned 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed call 35 never executed call 36 never executed call 37 never executed call 38 never executed call 39 never executed call 40 never executed call 41 never executed call 42 never executed call 43 never executed call 44 never executed call 45 never executed call 46 never executed call 47 never executed call 48 never executed 75: 76: return __cur; -: 77: } =====: 78: __catch(...) call 0 never executed call 1 never executed call 2 never executed call 3 never executed call 4 never executed call 5 never executed call 6 never executed call 7 never executed call 8 never executed call 9 never executed -: 79: { =====: 80: std::_Destroy(__result, __cur); call 0 never executed branch 1 never executed branch 2 never executed call 3 never executed branch 4 never executed branch 5 never executed call 6 never executed branch 7 never executed branch 8 never executed call 9 never executed branch 10 never executed branch 11 never executed call 12 never executed branch 13 never executed branch 14 never executed =====: 81: __throw_exception_again; call 0 never executed call 1 never executed call 2 never executed call 3 never executed call 4 never executed -: 82: } -: 83: } -: 84: }; -: 85: -: 86: template<> -: 87: struct __uninitialized_copy -: 88: { -: 89: template -: 90: static _ForwardIterator function _ZNSt20__uninitialized_copyILb1EE13__uninit_copyIPK10amino_acidPS2_EET0_T_S7_S6_ called 0 returned 0% blocks executed 0% function _ZNSt20__uninitialized_copyILb1EE13__uninit_copyIPK10amino_acidPS2_EET0_T_S7_S6_ called 0 returned 0% blocks executed 0% function _ZNSt20__uninitialized_copyILb1EE13__uninit_copyIN9__gnu_cxx17__normal_iteratorIPK10amino_acidSt6vectorIS4_SaIS4_EEEEPS4_EET0_T_SD_SC_ called 7 returned 100% blocks executed 100% function _ZNSt20__uninitialized_copyILb1EE13__uninit_copyIPK10amino_acidPS2_EET0_T_S7_S6_ called 0 returned 0% blocks executed 0% function _ZNSt20__uninitialized_copyILb1EE13__uninit_copyIPK10amino_acidPS2_EET0_T_S7_S6_ called 30 returned 100% blocks executed 100% function _ZNSt20__uninitialized_copyILb1EE13__uninit_copyIPK10amino_acidPS2_EET0_T_S7_S6_ called 0 returned 0% blocks executed 0% function _ZNSt20__uninitialized_copyILb1EE13__uninit_copyIPK10amino_acidPS2_EET0_T_S7_S6_ called 0 returned 0% blocks executed 0% function _ZNSt20__uninitialized_copyILb1EE13__uninit_copyIPKdPdEET0_T_S6_S5_ called 44 returned 100% blocks executed 100% function _ZNSt20__uninitialized_copyILb1EE13__uninit_copyISt13move_iteratorIPdES3_EET0_T_S6_S5_ called 0 returned 0% blocks executed 0% 81: 91: __uninit_copy(_InputIterator __first, _InputIterator __last, -: 92: _ForwardIterator __result) 81: 93: { return std::copy(__first, __last, __result); } call 0 never executed call 1 never executed call 2 returned 100% call 3 never executed call 4 returned 100% call 5 never executed call 6 never executed call 7 returned 100% call 8 never executed -: 94: }; -: 95: -: 96: /** -: 97: * @brief Copies the range [first,last) into result. -: 98: * @param __first An input iterator. -: 99: * @param __last An input iterator. -: 100: * @param __result An output iterator. -: 101: * @return __result + (__first - __last) -: 102: * -: 103: * Like copy(), but does not require an initialized output range. -: 104: */ -: 105: template -: 106: inline _ForwardIterator function _ZSt18uninitialized_copyIPK10amino_acidPS0_ET0_T_S5_S4_ called 0 returned 0% blocks executed 0% function _ZSt18uninitialized_copyIPK10amino_acidPS0_ET0_T_S5_S4_ called 0 returned 0% blocks executed 0% function _ZSt18uninitialized_copyIN9__gnu_cxx17__normal_iteratorIPK10amino_acidSt6vectorIS2_SaIS2_EEEEPS2_ET0_T_SB_SA_ called 7 returned 100% blocks executed 100% function _ZSt18uninitialized_copyIPK10amino_acidPS0_ET0_T_S5_S4_ called 0 returned 0% blocks executed 0% function _ZSt18uninitialized_copyIPK10amino_acidPS0_ET0_T_S5_S4_ called 30 returned 100% blocks executed 100% function _ZSt18uninitialized_copyIN9__gnu_cxx17__normal_iteratorIPK6bulletSt6vectorIS2_SaIS2_EEEEPS2_ET0_T_SB_SA_ called 12 returned 100% blocks executed 100% function _ZSt18uninitialized_copyISt13move_iteratorIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEES7_ET0_T_SA_S9_ called 6 returned 100% blocks executed 100% function _ZSt18uninitialized_copyIPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPS5_ET0_T_SA_S9_ called 2 returned 100% blocks executed 100% function _ZSt18uninitialized_copyIPK10amino_acidPS0_ET0_T_S5_S4_ called 0 returned 0% blocks executed 0% function _ZSt18uninitialized_copyIPK6bulletPS0_ET0_T_S5_S4_ called 2 returned 100% blocks executed 100% function _ZSt18uninitialized_copyISt13move_iteratorIP6bulletES2_ET0_T_S5_S4_ called 8 returned 100% blocks executed 100% function _ZSt18uninitialized_copyISt13move_iteratorIP6playerES2_ET0_T_S5_S4_ called 45 returned 100% blocks executed 100% function _ZSt18uninitialized_copyIPK10amino_acidPS0_ET0_T_S5_S4_ called 0 returned 0% blocks executed 0% function _ZSt18uninitialized_copyIPKdPdET0_T_S4_S3_ called 44 returned 100% blocks executed 100% function _ZSt18uninitialized_copyISt13move_iteratorIPdES1_ET0_T_S4_S3_ called 0 returned 0% blocks executed 0% function _ZSt18uninitialized_copyIN9__gnu_cxx17__normal_iteratorIPK6playerSt6vectorIS2_SaIS2_EEEEPS2_ET0_T_SB_SA_ called 0 returned 0% blocks executed 0% function _ZSt18uninitialized_copyISt13move_iteratorIP6bulletES2_ET0_T_S5_S4_ called 0 returned 0% blocks executed 0% function _ZSt18uninitialized_copyIN9__gnu_cxx17__normal_iteratorIPK6bulletSt6vectorIS2_SaIS2_EEEEPS2_ET0_T_SB_SA_ called 0 returned 0% blocks executed 0% function _ZSt18uninitialized_copyIP6bulletS1_ET0_T_S3_S2_ called 0 returned 0% blocks executed 0% 156: 107: uninitialized_copy(_InputIterator __first, _InputIterator __last, -: 108: _ForwardIterator __result) -: 109: { -: 110: typedef typename iterator_traits<_InputIterator>::value_type -: 111: _ValueType1; -: 112: typedef typename iterator_traits<_ForwardIterator>::value_type -: 113: _ValueType2; -: 114:#if __cplusplus < 201103L -: 115: const bool __assignable = true; -: 116:#else -: 117: // trivial types can have deleted assignment -: 118: typedef typename iterator_traits<_InputIterator>::reference _RefType1; -: 119: typedef typename iterator_traits<_ForwardIterator>::reference _RefType2; 156: 120: const bool __assignable = is_assignable<_RefType2, _RefType1>::value; -: 121:#endif -: 122: -: 123: return std::__uninitialized_copy<__is_trivial(_ValueType1) -: 124: && __is_trivial(_ValueType2) -: 125: && __assignable>:: 156: 126: __uninit_copy(__first, __last, __result); call 0 never executed call 1 never executed call 2 returned 100% call 3 never executed call 4 returned 100% call 5 returned 100% call 6 returned 100% call 7 returned 100% call 8 never executed call 9 returned 100% call 10 returned 100% call 11 returned 100% call 12 never executed call 13 returned 100% call 14 never executed call 15 never executed call 16 never executed call 17 never executed call 18 never executed -: 127: } -: 128: -: 129: -: 130: template -: 131: struct __uninitialized_fill -: 132: { -: 133: template -: 134: static void -: 135: __uninit_fill(_ForwardIterator __first, _ForwardIterator __last, -: 136: const _Tp& __x) -: 137: { -: 138: _ForwardIterator __cur = __first; -: 139: __try -: 140: { -: 141: for (; __cur != __last; ++__cur) -: 142: std::_Construct(std::__addressof(*__cur), __x); -: 143: } -: 144: __catch(...) -: 145: { -: 146: std::_Destroy(__first, __cur); -: 147: __throw_exception_again; -: 148: } -: 149: } -: 150: }; -: 151: -: 152: template<> -: 153: struct __uninitialized_fill -: 154: { -: 155: template -: 156: static void -: 157: __uninit_fill(_ForwardIterator __first, _ForwardIterator __last, -: 158: const _Tp& __x) -: 159: { std::fill(__first, __last, __x); } -: 160: }; -: 161: -: 162: /** -: 163: * @brief Copies the value x into the range [first,last). -: 164: * @param __first An input iterator. -: 165: * @param __last An input iterator. -: 166: * @param __x The source value. -: 167: * @return Nothing. -: 168: * -: 169: * Like fill(), but does not require an initialized output range. -: 170: */ -: 171: template -: 172: inline void -: 173: uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, -: 174: const _Tp& __x) -: 175: { -: 176: typedef typename iterator_traits<_ForwardIterator>::value_type -: 177: _ValueType; -: 178:#if __cplusplus < 201103L -: 179: const bool __assignable = true; -: 180:#else -: 181: // trivial types can have deleted assignment -: 182: const bool __assignable = is_copy_assignable<_ValueType>::value; -: 183:#endif -: 184: -: 185: std::__uninitialized_fill<__is_trivial(_ValueType) && __assignable>:: -: 186: __uninit_fill(__first, __last, __x); -: 187: } -: 188: -: 189: -: 190: template -: 191: struct __uninitialized_fill_n -: 192: { -: 193: template -: 194: static _ForwardIterator -: 195: __uninit_fill_n(_ForwardIterator __first, _Size __n, -: 196: const _Tp& __x) -: 197: { -: 198: _ForwardIterator __cur = __first; -: 199: __try -: 200: { -: 201: for (; __n > 0; --__n, ++__cur) -: 202: std::_Construct(std::__addressof(*__cur), __x); -: 203: return __cur; -: 204: } -: 205: __catch(...) -: 206: { -: 207: std::_Destroy(__first, __cur); -: 208: __throw_exception_again; -: 209: } -: 210: } -: 211: }; -: 212: -: 213: template<> -: 214: struct __uninitialized_fill_n -: 215: { -: 216: template -: 217: static _ForwardIterator -: 218: __uninit_fill_n(_ForwardIterator __first, _Size __n, -: 219: const _Tp& __x) -: 220: { return std::fill_n(__first, __n, __x); } -: 221: }; -: 222: -: 223: // _GLIBCXX_RESOLVE_LIB_DEFECTS -: 224: // DR 1339. uninitialized_fill_n should return the end of its range -: 225: /** -: 226: * @brief Copies the value x into the range [first,first+n). -: 227: * @param __first An input iterator. -: 228: * @param __n The number of copies to make. -: 229: * @param __x The source value. -: 230: * @return Nothing. -: 231: * -: 232: * Like fill_n(), but does not require an initialized output range. -: 233: */ -: 234: template -: 235: inline _ForwardIterator -: 236: uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) -: 237: { -: 238: typedef typename iterator_traits<_ForwardIterator>::value_type -: 239: _ValueType; -: 240:#if __cplusplus < 201103L -: 241: const bool __assignable = true; -: 242:#else -: 243: // trivial types can have deleted assignment -: 244: const bool __assignable = is_copy_assignable<_ValueType>::value; -: 245:#endif -: 246: return __uninitialized_fill_n<__is_trivial(_ValueType) && __assignable>:: -: 247: __uninit_fill_n(__first, __n, __x); -: 248: } -: 249: -: 250: // Extensions: versions of uninitialized_copy, uninitialized_fill, -: 251: // and uninitialized_fill_n that take an allocator parameter. -: 252: // We dispatch back to the standard versions when we're given the -: 253: // default allocator. For nondefault allocators we do not use -: 254: // any of the POD optimizations. -: 255: -: 256: template -: 258: _ForwardIterator -: 259: __uninitialized_copy_a(_InputIterator __first, _InputIterator __last, -: 260: _ForwardIterator __result, _Allocator& __alloc) -: 261: { -: 262: _ForwardIterator __cur = __result; -: 263: __try -: 264: { -: 265: typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; -: 266: for (; __first != __last; ++__first, ++__cur) -: 267: __traits::construct(__alloc, std::__addressof(*__cur), *__first); -: 268: return __cur; -: 269: } -: 270: __catch(...) -: 271: { -: 272: std::_Destroy(__result, __cur, __alloc); -: 273: __throw_exception_again; -: 274: } -: 275: } -: 276: -: 277: template -: 278: inline _ForwardIterator function _ZSt22__uninitialized_copy_aIPK10amino_acidPS0_S0_ET0_T_S5_S4_RSaIT1_E called 0 returned 0% blocks executed 0% function _ZSt22__uninitialized_copy_aIPK10amino_acidPS0_S0_ET0_T_S5_S4_RSaIT1_E called 0 returned 0% blocks executed 0% function _ZSt22__uninitialized_copy_aIN9__gnu_cxx17__normal_iteratorIPK10amino_acidSt6vectorIS2_SaIS2_EEEEPS2_S2_ET0_T_SB_SA_RSaIT1_E called 7 returned 100% blocks executed 100% function _ZSt22__uninitialized_copy_aIPK10amino_acidPS0_S0_ET0_T_S5_S4_RSaIT1_E called 0 returned 0% blocks executed 0% function _ZSt22__uninitialized_copy_aIPK10amino_acidPS0_S0_ET0_T_S5_S4_RSaIT1_E called 30 returned 100% blocks executed 100% function _ZSt22__uninitialized_copy_aIN9__gnu_cxx17__normal_iteratorIPK6bulletSt6vectorIS2_SaIS2_EEEEPS2_S2_ET0_T_SB_SA_RSaIT1_E called 12 returned 100% blocks executed 100% function _ZSt22__uninitialized_copy_aISt13move_iteratorIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEES7_S6_ET0_T_SA_S9_RSaIT1_E called 6 returned 100% blocks executed 100% function _ZSt22__uninitialized_copy_aIPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPS5_S5_ET0_T_SA_S9_RSaIT1_E called 2 returned 100% blocks executed 100% function _ZSt22__uninitialized_copy_aIPK10amino_acidPS0_S0_ET0_T_S5_S4_RSaIT1_E called 0 returned 0% blocks executed 0% function _ZSt22__uninitialized_copy_aIPK6bulletPS0_S0_ET0_T_S5_S4_RSaIT1_E called 2 returned 100% blocks executed 100% function _ZSt22__uninitialized_copy_aISt13move_iteratorIP6bulletES2_S1_ET0_T_S5_S4_RSaIT1_E called 8 returned 100% blocks executed 100% function _ZSt22__uninitialized_copy_aISt13move_iteratorIP6playerES2_S1_ET0_T_S5_S4_RSaIT1_E called 45 returned 100% blocks executed 100% function _ZSt22__uninitialized_copy_aIPK10amino_acidPS0_S0_ET0_T_S5_S4_RSaIT1_E called 0 returned 0% blocks executed 0% function _ZSt22__uninitialized_copy_aIPKdPddET0_T_S4_S3_RSaIT1_E called 44 returned 100% blocks executed 100% function _ZSt22__uninitialized_copy_aISt13move_iteratorIPdES1_dET0_T_S4_S3_RSaIT1_E called 0 returned 0% blocks executed 0% function _ZSt22__uninitialized_copy_aIN9__gnu_cxx17__normal_iteratorIPK6playerSt6vectorIS2_SaIS2_EEEEPS2_S2_ET0_T_SB_SA_RSaIT1_E called 0 returned 0% blocks executed 0% function _ZSt22__uninitialized_copy_aISt13move_iteratorIP6bulletES2_S1_ET0_T_S5_S4_RSaIT1_E called 0 returned 0% blocks executed 0% function _ZSt22__uninitialized_copy_aIN9__gnu_cxx17__normal_iteratorIPK6bulletSt6vectorIS2_SaIS2_EEEEPS2_S2_ET0_T_SB_SA_RSaIT1_E called 0 returned 0% blocks executed 0% function _ZSt22__uninitialized_copy_aIP6bulletS1_S0_ET0_T_S3_S2_RSaIT1_E called 0 returned 0% blocks executed 0% 156: 279: __uninitialized_copy_a(_InputIterator __first, _InputIterator __last, -: 280: _ForwardIterator __result, allocator<_Tp>&) 156: 281: { return std::uninitialized_copy(__first, __last, __result); } call 0 never executed call 1 never executed call 2 returned 100% call 3 never executed call 4 returned 100% call 5 returned 100% call 6 returned 100% call 7 returned 100% call 8 never executed call 9 returned 100% call 10 returned 100% call 11 returned 100% call 12 never executed call 13 returned 100% call 14 never executed call 15 never executed call 16 never executed call 17 never executed call 18 never executed -: 282: -: 283: template -: 285: inline _ForwardIterator -: 286: __uninitialized_move_a(_InputIterator __first, _InputIterator __last, -: 287: _ForwardIterator __result, _Allocator& __alloc) -: 288: { -: 289: return std::__uninitialized_copy_a(_GLIBCXX_MAKE_MOVE_ITERATOR(__first), -: 290: _GLIBCXX_MAKE_MOVE_ITERATOR(__last), -: 291: __result, __alloc); -: 292: } -: 293: -: 294: template -: 296: inline _ForwardIterator function _ZSt34__uninitialized_move_if_noexcept_aIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_SaIS5_EET0_T_S9_S8_RT1_ called 6 returned 100% blocks executed 100% function _ZSt34__uninitialized_move_if_noexcept_aIPdS0_SaIdEET0_T_S3_S2_RT1_ called 0 returned 0% blocks executed 0% function _ZSt34__uninitialized_move_if_noexcept_aIP6bulletS1_SaIS0_EET0_T_S4_S3_RT1_ called 8 returned 100% blocks executed 100% function _ZSt34__uninitialized_move_if_noexcept_aIP6playerS1_SaIS0_EET0_T_S4_S3_RT1_ called 45 returned 100% blocks executed 100% function _ZSt34__uninitialized_move_if_noexcept_aIP6bulletS1_SaIS0_EET0_T_S4_S3_RT1_ called 0 returned 0% blocks executed 0% 59: 297: __uninitialized_move_if_noexcept_a(_InputIterator __first, -: 298: _InputIterator __last, -: 299: _ForwardIterator __result, -: 300: _Allocator& __alloc) -: 301: { -: 302: return std::__uninitialized_copy_a 59: 303: (_GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__first), call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 never executed call 4 never executed call 5 never executed call 6 returned 100% call 7 returned 100% call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% call 12 never executed call 13 never executed call 14 never executed 59: 304: _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__last), __result, __alloc); call 0 returned 100% call 1 never executed call 2 returned 100% call 3 returned 100% call 4 never executed -: 305: } -: 306: -: 307: template -: 308: void -: 309: __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last, -: 310: const _Tp& __x, _Allocator& __alloc) -: 311: { -: 312: _ForwardIterator __cur = __first; -: 313: __try -: 314: { -: 315: typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; -: 316: for (; __cur != __last; ++__cur) -: 317: __traits::construct(__alloc, std::__addressof(*__cur), __x); -: 318: } -: 319: __catch(...) -: 320: { -: 321: std::_Destroy(__first, __cur, __alloc); -: 322: __throw_exception_again; -: 323: } -: 324: } -: 325: -: 326: template -: 327: inline void -: 328: __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last, -: 329: const _Tp& __x, allocator<_Tp2>&) -: 330: { std::uninitialized_fill(__first, __last, __x); } -: 331: -: 332: template -: 334: _ForwardIterator -: 335: __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, -: 336: const _Tp& __x, _Allocator& __alloc) -: 337: { -: 338: _ForwardIterator __cur = __first; -: 339: __try -: 340: { -: 341: typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; -: 342: for (; __n > 0; --__n, ++__cur) -: 343: __traits::construct(__alloc, std::__addressof(*__cur), __x); -: 344: return __cur; -: 345: } -: 346: __catch(...) -: 347: { -: 348: std::_Destroy(__first, __cur, __alloc); -: 349: __throw_exception_again; -: 350: } -: 351: } -: 352: -: 353: template -: 355: inline _ForwardIterator -: 356: __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, -: 357: const _Tp& __x, allocator<_Tp2>&) -: 358: { return std::uninitialized_fill_n(__first, __n, __x); } -: 359: -: 360: -: 361: // Extensions: __uninitialized_copy_move, __uninitialized_move_copy, -: 362: // __uninitialized_fill_move, __uninitialized_move_fill. -: 363: // All of these algorithms take a user-supplied allocator, which is used -: 364: // for construction and destruction. -: 365: -: 366: // __uninitialized_copy_move -: 367: // Copies [first1, last1) into [result, result + (last1 - first1)), and -: 368: // move [first2, last2) into -: 369: // [result, result + (last1 - first1) + (last2 - first2)). -: 370: template -: 372: inline _ForwardIterator -: 373: __uninitialized_copy_move(_InputIterator1 __first1, -: 374: _InputIterator1 __last1, -: 375: _InputIterator2 __first2, -: 376: _InputIterator2 __last2, -: 377: _ForwardIterator __result, -: 378: _Allocator& __alloc) -: 379: { -: 380: _ForwardIterator __mid = std::__uninitialized_copy_a(__first1, __last1, -: 381: __result, -: 382: __alloc); -: 383: __try -: 384: { -: 385: return std::__uninitialized_move_a(__first2, __last2, __mid, __alloc); -: 386: } -: 387: __catch(...) -: 388: { -: 389: std::_Destroy(__result, __mid, __alloc); -: 390: __throw_exception_again; -: 391: } -: 392: } -: 393: -: 394: // __uninitialized_move_copy -: 395: // Moves [first1, last1) into [result, result + (last1 - first1)), and -: 396: // copies [first2, last2) into -: 397: // [result, result + (last1 - first1) + (last2 - first2)). -: 398: template -: 400: inline _ForwardIterator -: 401: __uninitialized_move_copy(_InputIterator1 __first1, -: 402: _InputIterator1 __last1, -: 403: _InputIterator2 __first2, -: 404: _InputIterator2 __last2, -: 405: _ForwardIterator __result, -: 406: _Allocator& __alloc) -: 407: { -: 408: _ForwardIterator __mid = std::__uninitialized_move_a(__first1, __last1, -: 409: __result, -: 410: __alloc); -: 411: __try -: 412: { -: 413: return std::__uninitialized_copy_a(__first2, __last2, __mid, __alloc); -: 414: } -: 415: __catch(...) -: 416: { -: 417: std::_Destroy(__result, __mid, __alloc); -: 418: __throw_exception_again; -: 419: } -: 420: } -: 421: -: 422: // __uninitialized_fill_move -: 423: // Fills [result, mid) with x, and moves [first, last) into -: 424: // [mid, mid + (last - first)). -: 425: template -: 427: inline _ForwardIterator -: 428: __uninitialized_fill_move(_ForwardIterator __result, _ForwardIterator __mid, -: 429: const _Tp& __x, _InputIterator __first, -: 430: _InputIterator __last, _Allocator& __alloc) -: 431: { -: 432: std::__uninitialized_fill_a(__result, __mid, __x, __alloc); -: 433: __try -: 434: { -: 435: return std::__uninitialized_move_a(__first, __last, __mid, __alloc); -: 436: } -: 437: __catch(...) -: 438: { -: 439: std::_Destroy(__result, __mid, __alloc); -: 440: __throw_exception_again; -: 441: } -: 442: } -: 443: -: 444: // __uninitialized_move_fill -: 445: // Moves [first1, last1) into [first2, first2 + (last1 - first1)), and -: 446: // fills [first2 + (last1 - first1), last2) with x. -: 447: template -: 449: inline void -: 450: __uninitialized_move_fill(_InputIterator __first1, _InputIterator __last1, -: 451: _ForwardIterator __first2, -: 452: _ForwardIterator __last2, const _Tp& __x, -: 453: _Allocator& __alloc) -: 454: { -: 455: _ForwardIterator __mid2 = std::__uninitialized_move_a(__first1, __last1, -: 456: __first2, -: 457: __alloc); -: 458: __try -: 459: { -: 460: std::__uninitialized_fill_a(__mid2, __last2, __x, __alloc); -: 461: } -: 462: __catch(...) -: 463: { -: 464: std::_Destroy(__first2, __mid2, __alloc); -: 465: __throw_exception_again; -: 466: } -: 467: } -: 468: -: 469:#if __cplusplus >= 201103L -: 470: // Extensions: __uninitialized_default, __uninitialized_default_n, -: 471: // __uninitialized_default_a, __uninitialized_default_n_a. -: 472: -: 473: template -: 474: struct __uninitialized_default_1 -: 475: { -: 476: template -: 477: static void -: 478: __uninit_default(_ForwardIterator __first, _ForwardIterator __last) -: 479: { -: 480: _ForwardIterator __cur = __first; -: 481: __try -: 482: { -: 483: for (; __cur != __last; ++__cur) -: 484: std::_Construct(std::__addressof(*__cur)); -: 485: } -: 486: __catch(...) -: 487: { -: 488: std::_Destroy(__first, __cur); -: 489: __throw_exception_again; -: 490: } -: 491: } -: 492: }; -: 493: -: 494: template<> -: 495: struct __uninitialized_default_1 -: 496: { -: 497: template -: 498: static void -: 499: __uninit_default(_ForwardIterator __first, _ForwardIterator __last) -: 500: { -: 501: typedef typename iterator_traits<_ForwardIterator>::value_type -: 502: _ValueType; -: 503: -: 504: std::fill(__first, __last, _ValueType()); -: 505: } -: 506: }; -: 507: -: 508: template -: 509: struct __uninitialized_default_n_1 -: 510: { -: 511: template -: 512: static _ForwardIterator -: 513: __uninit_default_n(_ForwardIterator __first, _Size __n) -: 514: { -: 515: _ForwardIterator __cur = __first; -: 516: __try -: 517: { -: 518: for (; __n > 0; --__n, ++__cur) -: 519: std::_Construct(std::__addressof(*__cur)); -: 520: return __cur; -: 521: } -: 522: __catch(...) -: 523: { -: 524: std::_Destroy(__first, __cur); -: 525: __throw_exception_again; -: 526: } -: 527: } -: 528: }; -: 529: -: 530: template<> -: 531: struct __uninitialized_default_n_1 -: 532: { -: 533: template -: 534: static _ForwardIterator -: 535: __uninit_default_n(_ForwardIterator __first, _Size __n) -: 536: { -: 537: typedef typename iterator_traits<_ForwardIterator>::value_type -: 538: _ValueType; -: 539: -: 540: return std::fill_n(__first, __n, _ValueType()); -: 541: } -: 542: }; -: 543: -: 544: // __uninitialized_default -: 545: // Fills [first, last) with std::distance(first, last) default -: 546: // constructed value_types(s). -: 547: template -: 548: inline void -: 549: __uninitialized_default(_ForwardIterator __first, -: 550: _ForwardIterator __last) -: 551: { -: 552: typedef typename iterator_traits<_ForwardIterator>::value_type -: 553: _ValueType; -: 554: // trivial types can have deleted assignment -: 555: const bool __assignable = is_copy_assignable<_ValueType>::value; -: 556: -: 557: std::__uninitialized_default_1<__is_trivial(_ValueType) -: 558: && __assignable>:: -: 559: __uninit_default(__first, __last); -: 560: } -: 561: -: 562: // __uninitialized_default_n -: 563: // Fills [first, first + n) with n default constructed value_type(s). -: 564: template -: 565: inline _ForwardIterator -: 566: __uninitialized_default_n(_ForwardIterator __first, _Size __n) -: 567: { -: 568: typedef typename iterator_traits<_ForwardIterator>::value_type -: 569: _ValueType; -: 570: // trivial types can have deleted assignment -: 571: const bool __assignable = is_copy_assignable<_ValueType>::value; -: 572: -: 573: return __uninitialized_default_n_1<__is_trivial(_ValueType) -: 574: && __assignable>:: -: 575: __uninit_default_n(__first, __n); -: 576: } -: 577: -: 578: -: 579: // __uninitialized_default_a -: 580: // Fills [first, last) with std::distance(first, last) default -: 581: // constructed value_types(s), constructed with the allocator alloc. -: 582: template -: 583: void -: 584: __uninitialized_default_a(_ForwardIterator __first, -: 585: _ForwardIterator __last, -: 586: _Allocator& __alloc) -: 587: { -: 588: _ForwardIterator __cur = __first; -: 589: __try -: 590: { -: 591: typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; -: 592: for (; __cur != __last; ++__cur) -: 593: __traits::construct(__alloc, std::__addressof(*__cur)); -: 594: } -: 595: __catch(...) -: 596: { -: 597: std::_Destroy(__first, __cur, __alloc); -: 598: __throw_exception_again; -: 599: } -: 600: } -: 601: -: 602: template -: 603: inline void -: 604: __uninitialized_default_a(_ForwardIterator __first, -: 605: _ForwardIterator __last, -: 606: allocator<_Tp>&) -: 607: { std::__uninitialized_default(__first, __last); } -: 608: -: 609: -: 610: // __uninitialized_default_n_a -: 611: // Fills [first, first + n) with n default constructed value_types(s), -: 612: // constructed with the allocator alloc. -: 613: template -: 614: _ForwardIterator -: 615: __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, -: 616: _Allocator& __alloc) -: 617: { -: 618: _ForwardIterator __cur = __first; -: 619: __try -: 620: { -: 621: typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; -: 622: for (; __n > 0; --__n, ++__cur) -: 623: __traits::construct(__alloc, std::__addressof(*__cur)); -: 624: return __cur; -: 625: } -: 626: __catch(...) -: 627: { -: 628: std::_Destroy(__first, __cur, __alloc); -: 629: __throw_exception_again; -: 630: } -: 631: } -: 632: -: 633: template -: 634: inline _ForwardIterator -: 635: __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, -: 636: allocator<_Tp>&) -: 637: { return std::__uninitialized_default_n(__first, __n); } -: 638: -: 639: -: 640: template -: 642: _ForwardIterator -: 643: __uninitialized_copy_n(_InputIterator __first, _Size __n, -: 644: _ForwardIterator __result, input_iterator_tag) -: 645: { -: 646: _ForwardIterator __cur = __result; -: 647: __try -: 648: { -: 649: for (; __n > 0; --__n, ++__first, ++__cur) -: 650: std::_Construct(std::__addressof(*__cur), *__first); -: 651: return __cur; -: 652: } -: 653: __catch(...) -: 654: { -: 655: std::_Destroy(__result, __cur); -: 656: __throw_exception_again; -: 657: } -: 658: } -: 659: -: 660: template -: 662: inline _ForwardIterator -: 663: __uninitialized_copy_n(_RandomAccessIterator __first, _Size __n, -: 664: _ForwardIterator __result, -: 665: random_access_iterator_tag) -: 666: { return std::uninitialized_copy(__first, __first + __n, __result); } -: 667: -: 668: /** -: 669: * @brief Copies the range [first,first+n) into result. -: 670: * @param __first An input iterator. -: 671: * @param __n The number of elements to copy. -: 672: * @param __result An output iterator. -: 673: * @return __result + __n -: 674: * -: 675: * Like copy_n(), but does not require an initialized output range. -: 676: */ -: 677: template -: 678: inline _ForwardIterator -: 679: uninitialized_copy_n(_InputIterator __first, _Size __n, -: 680: _ForwardIterator __result) -: 681: { return std::__uninitialized_copy_n(__first, __n, __result, -: 682: std::__iterator_category(__first)); } -: 683:#endif -: 684: -: 685:_GLIBCXX_END_NAMESPACE_VERSION -: 686:} // namespace -: 687: -: 688:#endif /* _STL_UNINITIALIZED_H */ <<<<<< EOF # path=/home/travis/build/richelbilderbeek/AminoAcidFighter/#usr#include#boost#core#noncopyable.hpp.gcov -: 0:Source:/usr/include/boost/core/noncopyable.hpp -: 0:Programs:19 -: 1:// Boost noncopyable.hpp header file --------------------------------------// -: 2: -: 3:// (C) Copyright Beman Dawes 1999-2003. Distributed under the Boost -: 4:// Software License, Version 1.0. (See accompanying file -: 5:// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -: 6: -: 7:// See http://www.boost.org/libs/utility for documentation. -: 8: -: 9:#ifndef BOOST_CORE_NONCOPYABLE_HPP -: 10:#define BOOST_CORE_NONCOPYABLE_HPP -: 11: -: 12:#include -: 13: -: 14:namespace boost { -: 15: -: 16:// Private copy constructor and copy assignment ensure classes derived from -: 17:// class noncopyable cannot be copied. -: 18: -: 19:// Contributed by Dave Abrahams -: 20: -: 21:namespace noncopyable_ // protection from unintended ADL -: 22:{ -: 23: class noncopyable -: 24: { -: 25: protected: -: 26:#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) && !defined(BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS) function _ZN5boost12noncopyable_11noncopyableC2Ev called 0 returned 0% blocks executed 0% function _ZN5boost12noncopyable_11noncopyableC2Ev called 0 returned 0% blocks executed 0% function _ZN5boost12noncopyable_11noncopyableC2Ev called 0 returned 0% blocks executed 0% function _ZN5boost12noncopyable_11noncopyableC2Ev called 0 returned 0% blocks executed 0% function _ZN5boost12noncopyable_11noncopyableC2Ev called 0 returned 0% blocks executed 0% function _ZN5boost12noncopyable_11noncopyableC2Ev called 0 returned 0% blocks executed 0% function _ZN5boost12noncopyable_11noncopyableC2Ev called 0 returned 0% blocks executed 0% function _ZN5boost12noncopyable_11noncopyableC2Ev called 0 returned 0% blocks executed 0% #####: 27: BOOST_CONSTEXPR noncopyable() = default; -: 28: ~noncopyable() = default; -: 29:#else -: 30: noncopyable() {} -: 31: ~noncopyable() {} -: 32:#endif -: 33:#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) -: 34: noncopyable( const noncopyable& ) = delete; -: 35: noncopyable& operator=( const noncopyable& ) = delete; -: 36:#else -: 37: private: // emphasize the following members are private -: 38: noncopyable( const noncopyable& ); -: 39: noncopyable& operator=( const noncopyable& ); -: 40:#endif -: 41: }; -: 42:} -: 43: -: 44:typedef noncopyable_::noncopyable noncopyable; -: 45: -: 46:} // namespace boost -: 47: -: 48:#endif // BOOST_CORE_NONCOPYABLE_HPP <<<<<< EOF # path=/home/travis/build/richelbilderbeek/AminoAcidFighter/player.cpp.gcov -: 0:Source:player.cpp -: 0:Programs:19 -: 1:#include "player.h" -: 2: -: 3:#include -: 4:#include -: 5:#include -: 6:#include "helper.h" -: 7: function _ZN6playerC2E10amino_aciddd called 47 returned 100% blocks executed 100% 47: 8:player::player( -: 9: amino_acid any_amino_acid, -: 10: const double x, -: 11: const double y -: 12:) -: 13: : -: 14: m_amino_acid{any_amino_acid}, -: 15: m_hp{100.0}, -: 16: m_rotation_deg{0.0}, -: 17: m_speed_x{0.0}, -: 18: m_speed_y{0.0}, -: 19: m_turn_speed_deg_per_tick{0.0}, -: 20: m_uses_power{false}, -: 21: m_x{x}, 47: 22: m_y{y} call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% call 6 returned 100% call 7 returned 100% call 8 returned 100% 47: 23:{} -: 24: function _ZN6player10accelerateEv called 4 returned 100% blocks executed 100% 4: 25:void player::accelerate() -: 26:{ -: 27: //const auto angle_degrees = m_rotation_deg - 30.0; 4: 28: m_speed_x += std::cos( deg_to_rad(m_rotation_deg)) * 0.1; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 4: 29: m_speed_y -= std::sin(-deg_to_rad(m_rotation_deg)) * 0.1; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 4: 30:} -: 31: function _ZN6player10decelerateEv called 1 returned 100% blocks executed 100% 1: 32:void player::decelerate() -: 33:{ -: 34: //const auto angle_degrees = m_sprite->getRotation() - 30.0; 1: 35: m_speed_x -= std::cos( deg_to_rad(m_rotation_deg)) * 0.1; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 1: 36: m_speed_y += std::sin(-deg_to_rad(m_rotation_deg)) * 0.1; call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 1: 37:} -: 38: function _Z12get_positionRK6player called 502 returned 100% blocks executed 100% 502: 39:std::pair get_position(const player& p) noexcept -: 40:{ 502: 41: return std::make_pair(p.get_x(), p.get_y()); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% call 6 returned 100% -: 42:} -: 43: function _Z9get_power10amino_acid called 1 returned 100% blocks executed 13% 1: 44:power get_power(const amino_acid any_aa) noexcept //!OCLINT cannot make this any shorter -: 45:{ 1: 46: switch (any_aa) { branch 0 taken 0% branch 1 taken 0% branch 2 taken 0% branch 3 taken 0% branch 4 taken 0% branch 5 taken 0% branch 6 taken 0% branch 7 taken 0% branch 8 taken 0% branch 9 taken 0% branch 10 taken 0% branch 11 taken 0% branch 12 taken 0% branch 13 taken 0% branch 14 taken 0% branch 15 taken 0% branch 16 taken 0% branch 17 taken 0% branch 18 taken 100% branch 19 taken 0% branch 20 taken 0% #####: 47: case amino_acid::alanine: return power::stop_bullets; #####: 48: case amino_acid::arginine: return power::shield; #####: 49: case amino_acid::asparagine: return power::shield; #####: 50: case amino_acid::aspartic_acid: return power::shield; #####: 51: case amino_acid::cysteine: return power::shield; #####: 52: case amino_acid::glutamic_acid: return power::shield; #####: 53: case amino_acid::glutamine: return power::shield; #####: 54: case amino_acid::glycine: return power::shield; #####: 55: case amino_acid::histidine: return power::shield; #####: 56: case amino_acid::isoleucine: return power::shield; #####: 57: case amino_acid::leucine: return power::shield; #####: 58: case amino_acid::lysine: return power::shield; #####: 59: case amino_acid::methionine: return power::shield; #####: 60: case amino_acid::phenylalanine: return power::shield; #####: 61: case amino_acid::proline: return power::shield; #####: 62: case amino_acid::serine: return power::shield; #####: 63: case amino_acid::threonine: return power::shield; #####: 64: case amino_acid::tryptophan: return power::shield; 1: 65: case amino_acid::tyrosine: return power::shield; #####: 66: case amino_acid::valine: return power::shield; -: 67: } #####: 68: assert(!"Should not get here"); //!OCLINT accepted idiom call 0 never executed -: 69: return power::shield; -: 70:} -: 71: function _ZN6player4moveEd called 5210 returned 100% blocks executed 92% 5210: 72:void player::move(const double world_size) -: 73:{ 5210: 74: assert(world_size > 0.0); branch 0 taken 0% (fallthrough) branch 1 taken 100% call 2 never executed -: 75: //Keep m_x in [0, world_size> 5210: 76: m_x = std::fmod(m_x + m_speed_x + world_size, world_size); call 0 returned 100% call 1 returned 100% call 2 returned 100% -: 77: //Keep m_y in [0, world_size> 5210: 78: m_y = std::fmod(m_y + m_speed_y + world_size, world_size); call 0 returned 100% call 1 returned 100% call 2 returned 100% 5210: 79: m_rotation_deg += m_turn_speed_deg_per_tick; call 0 returned 100% call 1 returned 100% call 2 returned 100% 5210: 80:} -: 81: -: 82: function _Z5shootRK6player called 6 returned 100% blocks executed 100% 6: 83:bullet shoot(const player& any_player) -: 84:{ 6: 85: auto rot_degree = any_player.get_rotation() + 30 + 10.7389; call 0 returned 100% call 1 returned 100% -: 86: //10.7389 = angle from turn origin to shooter origin 6: 87: auto rot_radians = rot_degree * M_PI / 180; 6: 88: auto pos_x = any_player.get_x(); call 0 returned 100% call 1 returned 100% 6: 89: auto pos_y = any_player.get_y(); call 0 returned 100% call 1 returned 100% 6: 90: float x_shooter = pos_x + (32*std::cos(rot_radians)); //GOOD 6: 91: float y_shooter = pos_y + (32*std::sin(rot_radians)); //GOOD -: 92: -: 93: //shoot angle 6: 94: double angle_deg = rot_degree + 90 + 18; -: 95: //18 = angle from hitrange to shooter origin 6: 96: double angle_rad = angle_deg * M_PI / 180; 6: 97: const double speed_x{ std::sin(angle_rad) * 1.5}; 6: 98: const double speed_y{-std::cos(angle_rad) * 1.5}; 6: 99: return bullet(10, x_shooter, y_shooter, speed_x, speed_y); call 0 returned 100% -: 100:} -: 101: function _ZN6player4stopEv called 0 returned 0% blocks executed 0% #####: 102:void player::stop() -: 103:{ #####: 104: m_speed_x = 0.0; call 0 never executed #####: 105: m_speed_y = 0.0; call 0 never executed #####: 106: m_turn_speed_deg_per_tick = 0.0; call 0 never executed #####: 107:} -: 108: function _ZN6player9turn_leftEv called 2 returned 100% blocks executed 100% 2: 109:void player::turn_left() -: 110:{ 2: 111: m_turn_speed_deg_per_tick -= 0.1; call 0 returned 100% call 1 returned 100% 2: 112:} -: 113: function _ZN6player10turn_rightEv called 2 returned 100% blocks executed 100% 2: 114:void player::turn_right() -: 115:{ 2: 116: m_turn_speed_deg_per_tick += 0.1; call 0 returned 100% call 1 returned 100% 2: 117:} -: 118: function _ZNK6player10uses_powerEv called 9 returned 100% blocks executed 80% 9: 119:bool player::uses_power() const -: 120:{ 9: 121: return m_uses_power; call 0 returned 100% branch 1 taken 0% (fallthrough) branch 2 taken 100% -: 122:} -: 123: function _ZN6player17start_using_powerER4game called 5 returned 100% blocks executed 100% 5: 124:void player::start_using_power(game& g) -: 125:{ 5: 126: m_uses_power = true; call 0 returned 100% 5: 127: do_stop_bullets(g); call 0 returned 100% call 1 returned 100% 5: 128:} -: 129: function _ZN6player16stop_using_powerER4game called 5210 returned 100% blocks executed 100% 5210: 130:void player::stop_using_power(game& ) -: 131:{ 5210: 132: m_uses_power = false; call 0 returned 100% 5210: 133:} -: 134: function _ZN6player7lose_hpEv called 1004 returned 100% blocks executed 100% 1004: 135:void player::lose_hp() -: 136:{ 1004: 137: m_hp -= 0.1; call 0 returned 100% call 1 returned 100% 1004: 138:} -: 139: function _Z18get_hit_range_sizev called 2012 returned 100% blocks executed 100% 2012: 140:double get_hit_range_size() -: 141:{ 2012: 142: return 25.0; -: 143:} -: 144: function _ZeqRK6playerS1_ called 2 returned 100% blocks executed 98% 2: 145:bool operator==(const player& lhs, const player& rhs) noexcept -: 146:{ -: 147: return 2: 148: lhs.get_amino_acid() == rhs.get_amino_acid() call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% 2: 149: && lhs.get_hp() == rhs.get_hp() call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% branch 4 taken 100% (fallthrough) branch 5 taken 0% 2: 150: && lhs.get_rotation() == rhs.get_rotation() call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% branch 4 taken 100% (fallthrough) branch 5 taken 0% 2: 151: && lhs.get_speed_x() == rhs.get_speed_x() call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% branch 4 taken 100% (fallthrough) branch 5 taken 0% 2: 152: && lhs.get_speed_y() == rhs.get_speed_y() call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% branch 4 taken 100% (fallthrough) branch 5 taken 0% 2: 153: && lhs.get_turn_speed() == rhs.get_turn_speed() call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% branch 4 taken 100% (fallthrough) branch 5 taken 0% 2: 154: && lhs.get_x() == rhs.get_x() call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% branch 4 taken 100% (fallthrough) branch 5 taken 0% 4: 155: && lhs.get_y() == rhs.get_y(); branch 0 taken 100% (fallthrough) branch 1 taken 0% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% -: 156:} -: 157: function _ZlsRSoRK6player called 0 returned 0% blocks executed 0% #####: 158:std::ostream& operator<<(std::ostream& os, const player& any_player) noexcept -: 159:{ -: 160: os #####: 161: << "HP: " << any_player.get_hp() << '\n' call 0 never executed call 1 never executed call 2 never executed call 3 never executed call 4 never executed call 5 never executed call 6 never executed call 7 never executed call 8 never executed call 9 never executed #####: 162: << "rotation (deg): " << any_player.get_rotation() << '\n' call 0 never executed call 1 never executed call 2 never executed call 3 never executed call 4 never executed call 5 never executed call 6 never executed call 7 never executed call 8 never executed call 9 never executed #####: 163: << "speed: " << any_player.get_speed_x() << ", " << any_player.get_speed_y() << '\n' call 0 never executed call 1 never executed call 2 never executed call 3 never executed call 4 never executed call 5 never executed call 6 never executed call 7 never executed call 8 never executed call 9 never executed call 10 never executed call 11 never executed call 12 never executed call 13 never executed call 14 never executed call 15 never executed call 16 never executed call 17 never executed #####: 164: << "position: " << any_player.get_x() << ", " << any_player.get_y() << '\n' call 0 never executed call 1 never executed call 2 never executed call 3 never executed call 4 never executed call 5 never executed call 6 never executed call 7 never executed call 8 never executed call 9 never executed call 10 never executed call 11 never executed call 12 never executed call 13 never executed call 14 never executed call 15 never executed call 16 never executed #####: 165: ; call 0 never executed #####: 166: return os; call 0 never executed function _GLOBAL__sub_I_player.cpp called 1 returned 100% blocks executed 100% function _Z41__static_initialization_and_destruction_0ii called 1 returned 100% blocks executed 100% 3: 167:} call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% branch 3 taken 100% (fallthrough) branch 4 taken 0% <<<<<< EOF # path=/home/travis/build/richelbilderbeek/AminoAcidFighter/amino_acid_test.cpp.gcov -: 0:Source:amino_acid_test.cpp -: 0:Programs:19 -: 1:#include -: 2:#include "amino_acid.h" -: 3: function _ZN31get_next_on_valine_does_nothing11test_methodEv called 1 returned 100% blocks executed 71% function _ZL39get_next_on_valine_does_nothing_invokerv called 1 returned 100% blocks executed 100% 3: 4:BOOST_AUTO_TEST_CASE(get_next_on_valine_does_nothing) call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% branch 10 taken 100% (fallthrough) branch 11 taken 0% (throw) call 12 returned 100% branch 13 taken 100% (fallthrough) branch 14 taken 0% (throw) call 15 returned 100% call 16 returned 100% call 17 never executed call 18 never executed call 19 never executed call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) -: 5:{ 1: 6: BOOST_CHECK(get_next(amino_acid::valine) == amino_acid::valine); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% branch 24 taken 100% (fallthrough) branch 25 taken 0% (throw) call 26 returned 100% call 27 returned 100% branch 28 taken 100% (fallthrough) branch 29 taken 0% (throw) call 30 returned 100% call 31 returned 100% call 32 returned 100% branch 33 taken 0% (fallthrough) branch 34 taken 100% branch 35 taken 0% (fallthrough) branch 36 taken 100% call 37 never executed call 38 never executed call 39 never executed call 40 never executed 1: 7:} -: 8: function _ZN32get_prev_on_alanine_does_nothing11test_methodEv called 1 returned 100% blocks executed 71% function _ZL40get_prev_on_alanine_does_nothing_invokerv called 1 returned 100% blocks executed 100% 3: 9:BOOST_AUTO_TEST_CASE(get_prev_on_alanine_does_nothing) call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% branch 10 taken 100% (fallthrough) branch 11 taken 0% (throw) call 12 returned 100% branch 13 taken 100% (fallthrough) branch 14 taken 0% (throw) call 15 returned 100% call 16 returned 100% call 17 never executed call 18 never executed call 19 never executed call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) -: 10:{ 1: 11: BOOST_CHECK(get_prev(amino_acid::alanine) == amino_acid::alanine); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% branch 24 taken 100% (fallthrough) branch 25 taken 0% (throw) call 26 returned 100% call 27 returned 100% branch 28 taken 100% (fallthrough) branch 29 taken 0% (throw) call 30 returned 100% call 31 returned 100% call 32 returned 100% branch 33 taken 0% (fallthrough) branch 34 taken 100% branch 35 taken 0% (fallthrough) branch 36 taken 100% call 37 never executed call 38 never executed call 39 never executed call 40 never executed 1: 12:} -: 13: function _ZN37get_next_and_get_prev_are_symmetrical11test_methodEv called 1 returned 100% blocks executed 72% function _ZL45get_next_and_get_prev_are_symmetrical_invokerv called 1 returned 100% blocks executed 100% 3: 14:BOOST_AUTO_TEST_CASE(get_next_and_get_prev_are_symmetrical) call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% branch 10 taken 100% (fallthrough) branch 11 taken 0% (throw) call 12 returned 100% branch 13 taken 100% (fallthrough) branch 14 taken 0% (throw) call 15 returned 100% call 16 returned 100% call 17 never executed call 18 never executed call 19 never executed call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) -: 15:{ 1: 16: BOOST_CHECK(get_next(get_prev(amino_acid::glycine)) == amino_acid::glycine); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% branch 24 taken 100% (fallthrough) branch 25 taken 0% (throw) call 26 returned 100% branch 27 taken 100% (fallthrough) branch 28 taken 0% (throw) call 29 returned 100% call 30 returned 100% branch 31 taken 100% (fallthrough) branch 32 taken 0% (throw) call 33 returned 100% call 34 returned 100% call 35 returned 100% branch 36 taken 0% (fallthrough) branch 37 taken 100% branch 38 taken 0% (fallthrough) branch 39 taken 100% call 40 never executed call 41 never executed call 42 never executed call 43 never executed 1: 17:} -: 18: function _ZN14glycine_to_str11test_methodEv called 1 returned 100% blocks executed 65% function _ZL22glycine_to_str_invokerv called 1 returned 100% blocks executed 100% 3: 19:BOOST_AUTO_TEST_CASE(glycine_to_str) call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% branch 10 taken 100% (fallthrough) branch 11 taken 0% (throw) call 12 returned 100% branch 13 taken 100% (fallthrough) branch 14 taken 0% (throw) call 15 returned 100% call 16 returned 100% call 17 never executed call 18 never executed call 19 returned 100% branch 20 taken 100% (fallthrough) branch 21 taken 0% (throw) -: 20:{ 1: 21: BOOST_CHECK_EQUAL(to_str(amino_acid::alanine ), "Alanine" ); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 22: BOOST_CHECK_EQUAL(to_str(amino_acid::arginine ), "Arginine" ); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 23: BOOST_CHECK_EQUAL(to_str(amino_acid::asparagine ), "Asparagine" ); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 24: BOOST_CHECK_EQUAL(to_str(amino_acid::aspartic_acid), "Aspartic_acid"); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 25: BOOST_CHECK_EQUAL(to_str(amino_acid::cysteine ), "Cysteine" ); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 26: BOOST_CHECK_EQUAL(to_str(amino_acid::glutamic_acid), "Glutamic_acid"); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 27: BOOST_CHECK_EQUAL(to_str(amino_acid::glutamine ), "Glutamine" ); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 28: BOOST_CHECK_EQUAL(to_str(amino_acid::glycine ), "Glycine" ); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 29: BOOST_CHECK_EQUAL(to_str(amino_acid::histidine ), "Histidine" ); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 30: BOOST_CHECK_EQUAL(to_str(amino_acid::isoleucine ), "Isoleucine" ); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 31: BOOST_CHECK_EQUAL(to_str(amino_acid::leucine ), "Leucine" ); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 32: BOOST_CHECK_EQUAL(to_str(amino_acid::lysine ), "Lysine" ); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 33: BOOST_CHECK_EQUAL(to_str(amino_acid::methionine ), "Methionine" ); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 34: BOOST_CHECK_EQUAL(to_str(amino_acid::phenylalanine), "Phenylalanine"); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 35: BOOST_CHECK_EQUAL(to_str(amino_acid::proline ), "Proline" ); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 36: BOOST_CHECK_EQUAL(to_str(amino_acid::serine ), "Serine" ); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 37: BOOST_CHECK_EQUAL(to_str(amino_acid::threonine ), "Threonine" ); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 38: BOOST_CHECK_EQUAL(to_str(amino_acid::tryptophan ), "Tryptophan" ); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 39: BOOST_CHECK_EQUAL(to_str(amino_acid::tyrosine ), "Tyrosine" ); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed call 34 never executed 1: 40: BOOST_CHECK_EQUAL(to_str(amino_acid::valine ), "Valine" ); call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% (throw) call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% branch 12 taken 100% (fallthrough) branch 13 taken 0% (throw) call 14 returned 100% call 15 returned 100% branch 16 taken 100% (fallthrough) branch 17 taken 0% (throw) call 18 returned 100% call 19 returned 100% call 20 returned 100% branch 21 taken 100% (fallthrough) branch 22 taken 0% (throw) call 23 returned 100% call 24 returned 100% call 25 returned 100% branch 26 taken 0% (fallthrough) branch 27 taken 100% branch 28 taken 0% (fallthrough) branch 29 taken 100% call 30 never executed call 31 never executed call 32 never executed call 33 never executed function _GLOBAL__sub_I_amino_acid_test.cpp called 1 returned 100% blocks executed 100% function _Z41__static_initialization_and_destruction_0ii called 1 returned 100% blocks executed 77% 4: 41:} call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% branch 3 taken 100% (fallthrough) branch 4 taken 0% <<<<<< EOF # path=/home/travis/build/richelbilderbeek/AminoAcidFighter/#usr#include#boost#test#floating_point_comparison.hpp.gcov -: 0:Source:/usr/include/boost/test/floating_point_comparison.hpp -: 0:Programs:19 -: 1:// (C) Copyright Gennadiy Rozental 2001-2008. -: 2:// Distributed under the Boost Software License, Version 1.0. -: 3:// (See accompanying file LICENSE_1_0.txt or copy at -: 4:// http://www.boost.org/LICENSE_1_0.txt) -: 5: -: 6:// See http://www.boost.org/libs/test for the library home page. -: 7:// -: 8:// File : $RCSfile$ -: 9:// -: 10:// Version : $Revision$ -: 11:// -: 12:// Description : defines algoirthms for comparing 2 floating point values -: 13:// *************************************************************************** -: 14: -: 15:#ifndef BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER -: 16:#define BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER -: 17: -: 18:// Boost.Test -: 19:#include -: 20:#include -: 21:#include -: 22: -: 23:// Boost -: 24:#include // for std::numeric_limits -: 25:#include // for numeric::conversion_traits -: 26:#include -: 27: -: 28:#include -: 29: -: 30://____________________________________________________________________________// -: 31: -: 32:namespace boost { -: 33: -: 34:namespace test_tools { -: 35: -: 36:using unit_test::readonly_property; -: 37: -: 38:// ************************************************************************** // -: 39:// ************** floating_point_comparison_type ************** // -: 40:// ************************************************************************** // -: 41: -: 42:enum floating_point_comparison_type { -: 43: FPC_STRONG, // "Very close" - equation 1' in docs, the default -: 44: FPC_WEAK // "Close enough" - equation 2' in docs. -: 45: -: 46:}; -: 47: -: 48:// ************************************************************************** // -: 49:// ************** details ************** // -: 50:// ************************************************************************** // -: 51: -: 52:namespace tt_detail { -: 53: -: 54:// FPT is Floating-Point Type: float, double, long double or User-Defined. -: 55:template -: 56:inline FPT function _ZN5boost10test_tools9tt_detail7fpt_absIdEET_S3_ called 8 returned 100% blocks executed 100% 8: 57:fpt_abs( FPT fpv ) -: 58:{ 8: 59: return fpv < static_cast(0) ? -fpv : fpv; branch 0 taken 25% (fallthrough) branch 1 taken 75% -: 60:} -: 61: -: 62://____________________________________________________________________________// -: 63: -: 64:template -: 65:struct fpt_limits { function _ZN5boost10test_tools9tt_detail10fpt_limitsIdE9min_valueEv called 4 returned 100% blocks executed 100% 4: 66: static FPT min_value() -: 67: { -: 68: return std::numeric_limits::is_specialized -: 69: ? (std::numeric_limits::min)() 4: 70: : 0; call 0 returned 100% call 1 returned 100% -: 71: } function _ZN5boost10test_tools9tt_detail10fpt_limitsIdE9max_valueEv called 0 returned 0% blocks executed 0% #####: 72: static FPT max_value() -: 73: { -: 74: return std::numeric_limits::is_specialized -: 75: ? (std::numeric_limits::max)() #####: 76: : static_cast(1000000); // for the our purpuses it doesn't really matter what value is returned here call 0 never executed call 1 never executed -: 77: } -: 78:}; -: 79: -: 80://____________________________________________________________________________// -: 81: -: 82:// both f1 and f2 are unsigned here -: 83:template -: 84:inline FPT function _ZN5boost10test_tools9tt_detail17safe_fpt_divisionIdEET_S3_S3_ called 4 returned 100% blocks executed 65% 4: 85:safe_fpt_division( FPT f1, FPT f2 ) -: 86:{ -: 87: // Avoid overflow. 4: 88: if( (f2 < static_cast(1)) && (f1 > f2*fpt_limits::max_value()) ) branch 0 taken 0% (fallthrough) branch 1 taken 100% call 2 never executed branch 3 never executed branch 4 never executed branch 5 taken 0% (fallthrough) branch 6 taken 100% #####: 89: return fpt_limits::max_value(); call 0 never executed -: 90: -: 91: // Avoid underflow. 8: 92: if( (f1 == static_cast(0)) || branch 0 taken 100% (fallthrough) branch 1 taken 0% branch 2 taken 100% (fallthrough) branch 3 taken 0% branch 4 taken 0% (fallthrough) branch 5 taken 100% branch 6 taken 0% (fallthrough) branch 7 taken 100% 4: 93: ((f2 > static_cast(1)) && (f1 < f2*fpt_limits::min_value())) ) call 0 returned 100% #####: 94: return static_cast(0); -: 95: 4: 96: return f1/f2; -: 97:} -: 98: -: 99://____________________________________________________________________________// -: 100: -: 101:} // namespace tt_detail -: 102: -: 103:// ************************************************************************** // -: 104:// ************** tolerance presentation types ************** // -: 105:// ************************************************************************** // -: 106: -: 107:template -: 108:struct percent_tolerance_t { function _ZN5boost10test_tools19percent_tolerance_tIdEC2Ed called 2 returned 100% blocks executed 100% 2: 109: explicit percent_tolerance_t( FPT v ) : m_value( v ) {} call 0 returned 100% -: 110: -: 111: FPT m_value; -: 112:}; -: 113: -: 114://____________________________________________________________________________// -: 115: -: 116:template function _ZN5boost10test_toolslsISodEERT_S3_NS0_19percent_tolerance_tIT0_EE called 0 returned 0% blocks executed 0% #####: 117:Out& operator<<( Out& out, percent_tolerance_t t ) -: 118:{ #####: 119: return out << t.m_value; call 0 never executed call 1 never executed call 2 never executed call 3 never executed call 4 never executed -: 120:} -: 121: -: 122://____________________________________________________________________________// -: 123: -: 124:template -: 125:inline percent_tolerance_t function _ZN5boost10test_tools17percent_toleranceIdEENS0_19percent_tolerance_tIT_EES3_ called 2 returned 100% blocks executed 100% 2: 126:percent_tolerance( FPT v ) -: 127:{ 2: 128: return percent_tolerance_t( v ); call 0 returned 100% -: 129:} -: 130: -: 131://____________________________________________________________________________// -: 132: -: 133:template -: 134:struct fraction_tolerance_t { -: 135: explicit fraction_tolerance_t( FPT v ) : m_value( v ) {} -: 136: -: 137: FPT m_value; -: 138:}; -: 139: -: 140://____________________________________________________________________________// -: 141: -: 142:template -: 143:Out& operator<<( Out& out, fraction_tolerance_t t ) -: 144:{ -: 145: return out << t.m_value; -: 146:} -: 147: -: 148://____________________________________________________________________________// -: 149: -: 150:template -: 151:inline fraction_tolerance_t -: 152:fraction_tolerance( FPT v ) -: 153:{ -: 154: return fraction_tolerance_t( v ); -: 155:} -: 156: -: 157://____________________________________________________________________________// -: 158: -: 159:// ************************************************************************** // -: 160:// ************** close_at_tolerance ************** // -: 161:// ************************************************************************** // -: 162: -: 163:template -: 164:class close_at_tolerance { -: 165:public: -: 166: // Public typedefs -: 167: typedef bool result_type; -: 168: -: 169: // Constructor -: 170: template function _ZN5boost10test_tools18close_at_toleranceIdEC2IdEENS0_19percent_tolerance_tIT_EENS0_30floating_point_comparison_typeE called 2 returned 100% blocks executed 100% 2: 171: explicit close_at_tolerance( percent_tolerance_t tolerance, -: 172: floating_point_comparison_type fpc_type = FPC_STRONG ) 2: 173: : p_fraction_tolerance( tt_detail::fpt_abs( static_cast(0.01)*tolerance.m_value ) ) -: 174: , p_strong_or_weak( fpc_type == FPC_STRONG ) 2: 175: , m_report_modifier( 100. ) call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% 2: 176: {} -: 177: template -: 178: explicit close_at_tolerance( fraction_tolerance_t tolerance, -: 179: floating_point_comparison_type fpc_type = FPC_STRONG ) -: 180: : p_fraction_tolerance( tt_detail::fpt_abs( tolerance.m_value ) ) -: 181: , p_strong_or_weak( fpc_type == FPC_STRONG ) -: 182: , m_report_modifier( 1. ) -: 183: {} -: 184: function _ZNK5boost10test_tools18close_at_toleranceIdEclEdd called 2 returned 100% blocks executed 49% 2: 185: predicate_result operator()( FPT left, FPT right ) const -: 186: { 2: 187: FPT diff = tt_detail::fpt_abs( left - right ); call 0 returned 100% 2: 188: FPT d1 = tt_detail::safe_fpt_division( diff, tt_detail::fpt_abs( right ) ); call 0 returned 100% call 1 returned 100% 2: 189: FPT d2 = tt_detail::safe_fpt_division( diff, tt_detail::fpt_abs( left ) ); call 0 returned 100% call 1 returned 100% -: 190: -: 191: predicate_result res( p_strong_or_weak 6: 192: ? (d1 <= p_fraction_tolerance.get() && d2 <= p_fraction_tolerance.get()) call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% 6: 193: : (d1 <= p_fraction_tolerance.get() || d2 <= p_fraction_tolerance.get()) ); call 0 returned 100% branch 1 taken 0% (fallthrough) branch 2 taken 100% branch 3 taken 100% (fallthrough) branch 4 taken 0% call 5 returned 100% branch 6 taken 100% (fallthrough) branch 7 taken 0% call 8 returned 100% branch 9 taken 100% (fallthrough) branch 10 taken 0% call 11 never executed call 12 never executed call 13 never executed branch 14 never executed branch 15 never executed call 16 never executed call 17 never executed call 18 never executed branch 19 never executed branch 20 never executed call 21 returned 100% -: 194: 2: 195: if( !res ) call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% (throw) branch 3 taken 0% (fallthrough) branch 4 taken 100% #####: 196: res.message() << (( d1 <= p_fraction_tolerance.get() ? d2 : d1 ) * m_report_modifier); call 0 never executed call 1 never executed call 2 never executed branch 3 never executed branch 4 never executed call 5 never executed call 6 never executed call 7 never executed branch 8 never executed branch 9 never executed call 10 never executed call 11 never executed branch 12 never executed branch 13 never executed call 14 never executed -: 197: 2: 198: return res; -: 199: } -: 200: -: 201: // Public properties -: 202: readonly_property p_fraction_tolerance; -: 203: readonly_property p_strong_or_weak; -: 204:private: -: 205: // Data members -: 206: FPT m_report_modifier; -: 207:}; -: 208: -: 209://____________________________________________________________________________// -: 210: -: 211:// ************************************************************************** // -: 212:// ************** check_is_close ************** // -: 213:// ************************************************************************** // -: 214: -: 215:struct BOOST_TEST_DECL check_is_close_t { -: 216: // Public typedefs -: 217: typedef bool result_type; -: 218: -: 219: template -: 220: predicate_result function _ZNK5boost10test_tools16check_is_close_tclIdddEENS0_16predicate_resultET_T0_NS0_19percent_tolerance_tIT1_EENS0_30floating_point_comparison_typeE called 2 returned 100% blocks executed 100% 2: 221: operator()( FPT1 left, FPT2 right, percent_tolerance_t tolerance, -: 222: floating_point_comparison_type fpc_type = FPC_STRONG ) const -: 223: { -: 224: // deduce "better" type from types of arguments being compared -: 225: // if one type is floating and the second integral we use floating type and -: 226: // value of integral type is promoted to the floating. The same for float and double -: 227: // But we don't want to compare two values of integral types using this tool. -: 228: typedef typename numeric::conversion_traits::supertype FPT; -: 229: BOOST_STATIC_ASSERT( !is_integral::value ); -: 230: 2: 231: close_at_tolerance pred( tolerance, fpc_type ); call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% (throw) -: 232: 2: 233: return pred( left, right ); call 0 returned 100% call 1 returned 100% branch 2 taken 100% (fallthrough) branch 3 taken 0% (throw) -: 234: } -: 235: template -: 236: predicate_result -: 237: operator()( FPT1 left, FPT2 right, fraction_tolerance_t tolerance, -: 238: floating_point_comparison_type fpc_type = FPC_STRONG ) const -: 239: { -: 240: // same as in a comment above -: 241: typedef typename numeric::conversion_traits::supertype FPT; -: 242: BOOST_STATIC_ASSERT( !is_integral::value ); -: 243: -: 244: close_at_tolerance pred( tolerance, fpc_type ); -: 245: -: 246: return pred( left, right ); -: 247: } -: 248:}; -: 249: -: 250:namespace { -: 251:check_is_close_t const& check_is_close = unit_test::ut_detail::static_constant::value; -: 252:} -: 253: -: 254://____________________________________________________________________________// -: 255: -: 256:// ************************************************************************** // -: 257:// ************** check_is_small ************** // -: 258:// ************************************************************************** // -: 259: -: 260:struct BOOST_TEST_DECL check_is_small_t { -: 261: // Public typedefs -: 262: typedef bool result_type; -: 263: -: 264: template -: 265: bool -: 266: operator()( FPT fpv, FPT tolerance ) const -: 267: { -: 268: return tt_detail::fpt_abs( fpv ) < tt_detail::fpt_abs( tolerance ); -: 269: } -: 270:}; -: 271: -: 272:namespace { -: 273:check_is_small_t const& check_is_small = unit_test::ut_detail::static_constant::value; -: 274:} -: 275: -: 276://____________________________________________________________________________// -: 277: -: 278:} // namespace test_tools -: 279: -: 280:} // namespace boost -: 281: -: 282://____________________________________________________________________________// -: 283: -: 284:#include -: 285: -: 286:#endif // BOOST_FLOATING_POINT_COMAPARISON_HPP_071894GER <<<<<< EOF # path=/home/travis/build/richelbilderbeek/AminoAcidFighter/winner_screen.cpp.gcov -: 0:Source:winner_screen.cpp -: 0:Programs:19 -: 1:#include "winner_screen.h" -: 2: function _ZN13winner_screenC2Ev called 0 returned 0% blocks executed 0% #####: 3:winner_screen::winner_screen() -: 4:{ -: 5: #####: 6:} -: 7: <<<<<< EOF # path=/home/travis/build/richelbilderbeek/AminoAcidFighter/#usr#include#boost#test#unit_test_suite_impl.hpp.gcov -: 0:Source:/usr/include/boost/test/unit_test_suite_impl.hpp -: 0:Programs:19 -: 1:// (C) Copyright Gennadiy Rozental 2001-2008. -: 2:// Distributed under the Boost Software License, Version 1.0. -: 3:// (See accompanying file LICENSE_1_0.txt or copy at -: 4:// http://www.boost.org/LICENSE_1_0.txt) -: 5: -: 6:// See http://www.boost.org/libs/test for the library home page. -: 7:// -: 8:// File : $RCSfile$ -: 9:// -: 10:// Version : $Revision$ -: 11:// -: 12:// Description : defines test_unit, test_case, test_case_results, test_suite and test_tree_visitor -: 13:// *************************************************************************** -: 14: -: 15:#ifndef BOOST_TEST_UNIT_TEST_SUITE_IMPL_HPP_071894GER -: 16:#define BOOST_TEST_UNIT_TEST_SUITE_IMPL_HPP_071894GER -: 17: -: 18:// Boost.Test -: 19:#include -: 20:#include -: 21:#include -: 22:#include -: 23:#include -: 24:#include -: 25:#include -: 26: -: 27:// Boost -: 28:#include -: 29:#include -: 30:#include -: 31:#include -: 32:#include -: 33: -: 34:// STL -: 35:#include // for typeid -: 36:#include // for std::string -: 37:#include // for std::list -: 38:#include // for std::vector -: 39: -: 40:#include -: 41: -: 42://____________________________________________________________________________// -: 43: -: 44:namespace boost { -: 45: -: 46:namespace unit_test { -: 47: -: 48:// ************************************************************************** // -: 49:// ************** test_unit ************** // -: 50:// ************************************************************************** // -: 51: -: 52:class BOOST_TEST_DECL test_unit { -: 53:public: -: 54: enum { type = tut_any }; -: 55: -: 56: // Constructor -: 57: test_unit( const_string tu_name, test_unit_type t ); -: 58: -: 59: // dependencies management -: 60: void depends_on( test_unit* tu ); -: 61: bool check_dependencies() const; -: 62: -: 63: // Public r/o properties -: 64: typedef BOOST_READONLY_PROPERTY(test_unit_id,(framework_impl)) id_t; -: 65: typedef BOOST_READONLY_PROPERTY(test_unit_id,(test_suite)) parent_id_t; -: 66: readonly_property p_type; // type for this test unit -: 67: readonly_property p_type_name; // "case"/"suite" -: 68: id_t p_id; // unique id for this test unit -: 69: parent_id_t p_parent_id; // parent test suite id -: 70: -: 71: // Public r/w properties -: 72: readwrite_property p_name; // name for this test unit -: 73: readwrite_property p_timeout; // timeout for the test unit execution -: 74: readwrite_property p_expected_failures; // number of expected failures in this test unit -: 75: mutable readwrite_property p_enabled; // enabled status for this unit -: 76: -: 77: void increase_exp_fail( unsigned num ); -: 78: -: 79:protected: -: 80: ~test_unit(); -: 81: -: 82:private: -: 83: // Data members -: 84: std::list m_dependencies; -: 85:}; -: 86: -: 87:// ************************************************************************** // -: 88:// ************** test_case_generator ************** // -: 89:// ************************************************************************** // -: 90: -: 91:class BOOST_TEST_DECL test_unit_generator { -: 92:public: -: 93: virtual test_unit* next() const = 0; -: 94: -: 95:protected: -: 96: BOOST_TEST_PROTECTED_VIRTUAL ~test_unit_generator() {} -: 97:}; -: 98: -: 99:// ************************************************************************** // -: 100:// ************** test_case ************** // -: 101:// ************************************************************************** // -: 102: -: 103:class BOOST_TEST_DECL test_case : public test_unit { -: 104:public: -: 105: enum { type = tut_case }; -: 106: -: 107: // Constructor -: 108: test_case( const_string tc_name, callback0<> const& test_func ); -: 109: -: 110: // Access methods -: 111: callback0<> const& test_func() const { return m_test_func; } -: 112: -: 113:private: -: 114: friend class framework_impl; -: 115: ~test_case() {} -: 116: -: 117: // BOOST_MSVC <= 1200 have problems with callback as property -: 118: // Data members -: 119: callback0<> m_test_func; -: 120:}; -: 121: -: 122:// ************************************************************************** // -: 123:// ************** test_suite ************** // -: 124:// ************************************************************************** // -: 125: -: 126:class BOOST_TEST_DECL test_suite : public test_unit { -: 127:public: -: 128: enum { type = tut_suite }; -: 129: -: 130: // Constructor -: 131: explicit test_suite( const_string ts_name ); -: 132: -: 133: // test unit list management -: 134: void add( test_unit* tu, counter_t expected_failures = 0, unsigned timeout = 0 ); -: 135: void add( test_unit_generator const& gen, unsigned timeout = 0 ); -: 136: void remove( test_unit_id id ); -: 137: -: 138: // access methods -: 139: test_unit_id get( const_string tu_name ) const; -: 140: std::size_t size() const { return m_members.size(); } -: 141: -: 142:protected: -: 143: friend BOOST_TEST_DECL -: 144: void traverse_test_tree( test_suite const&, test_tree_visitor& ); -: 145: friend class framework_impl; -: 146: virtual ~test_suite() {} -: 147: -: 148: // Data members -: 149: std::vector m_members; -: 150:}; -: 151: -: 152:// ************************************************************************** // -: 153:// ************** master_test_suite ************** // -: 154:// ************************************************************************** // -: 155: -: 156:class BOOST_TEST_DECL master_test_suite_t : public test_suite { -: 157:public: -: 158: master_test_suite_t() : test_suite( "Master Test Suite" ) -: 159: , argc( 0 ) -: 160: , argv( 0 ) -: 161: {} -: 162: -: 163: // Data members -: 164: int argc; -: 165: char** argv; -: 166:}; -: 167: -: 168: -: 169:// ************************************************************************** // -: 170:// ************** test_tree_visitor ************** // -: 171:// ************************************************************************** // -: 172: -: 173:class BOOST_TEST_DECL test_tree_visitor { -: 174:public: -: 175: // test tree visitor interface -: 176: virtual void visit( test_case const& ) {} -: 177: virtual bool test_suite_start( test_suite const& ) { return true; } -: 178: virtual void test_suite_finish( test_suite const& ) {} -: 179: -: 180:protected: -: 181: BOOST_TEST_PROTECTED_VIRTUAL ~test_tree_visitor() {} -: 182:}; -: 183: -: 184:// ************************************************************************** // -: 185:// ************** traverse_test_tree ************** // -: 186:// ************************************************************************** // -: 187: -: 188:BOOST_TEST_DECL void traverse_test_tree( test_case const&, test_tree_visitor& ); -: 189:BOOST_TEST_DECL void traverse_test_tree( test_suite const&, test_tree_visitor& ); -: 190:BOOST_TEST_DECL void traverse_test_tree( test_unit_id , test_tree_visitor& ); -: 191: -: 192://____________________________________________________________________________// -: 193: -: 194:inline void -: 195:traverse_test_tree( test_unit const& tu, test_tree_visitor& V ) -: 196:{ -: 197: if( tu.p_type == tut_case ) -: 198: traverse_test_tree( static_cast( tu ), V ); -: 199: else -: 200: traverse_test_tree( static_cast( tu ), V ); -: 201:} -: 202: -: 203://____________________________________________________________________________// -: 204: -: 205:// ************************************************************************** // -: 206:// ************** test_case_counter ************** // -: 207:// ************************************************************************** // -: 208: -: 209:class test_case_counter : public test_tree_visitor { -: 210:public: -: 211: // Constructor -: 212: test_case_counter() : p_count( 0 ) {} -: 213: -: 214: BOOST_READONLY_PROPERTY( counter_t, (test_case_counter)) p_count; -: 215:private: -: 216: // test tree visitor interface -: 217: virtual void visit( test_case const& ); -: 218: virtual bool test_suite_start( test_suite const& ts ) { return ts.p_enabled; } -: 219:}; -: 220: -: 221:// ************************************************************************** // -: 222:// ************** test_being_aborted ************** // -: 223:// ************************************************************************** // -: 224: -: 225:struct BOOST_TEST_DECL test_being_aborted {}; -: 226: -: 227:// ************************************************************************** // -: 228:// ************** object generators ************** // -: 229:// ************************************************************************** // -: 230: -: 231:namespace ut_detail { -: 232: -: 233:BOOST_TEST_DECL std::string normalize_test_case_name( const_string tu_name ); -: 234: -: 235:template -: 236:struct user_tc_method_invoker { -: 237: typedef void (UserTestCase::*TestMethod )(); -: 238: -: 239: user_tc_method_invoker( shared_ptr inst, TestMethod test_method ) -: 240: : m_inst( inst ), m_test_method( test_method ) {} -: 241: -: 242: void operator()() { ((*m_inst).*m_test_method)(); } -: 243: -: 244: shared_ptr m_inst; -: 245: TestMethod m_test_method; -: 246:}; -: 247: -: 248:} // namespace ut_detail -: 249: -: 250://____________________________________________________________________________// -: 251: -: 252:inline test_case* function _ZN5boost9unit_test14make_test_caseERKNS0_9callback0INS0_9ut_detail6unusedEEENS0_13basic_cstringIKcEE called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test14make_test_caseERKNS0_9callback0INS0_9ut_detail6unusedEEENS0_13basic_cstringIKcEE called 42 returned 100% blocks executed 73% function _ZN5boost9unit_test14make_test_caseERKNS0_9callback0INS0_9ut_detail6unusedEEENS0_13basic_cstringIKcEE called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test14make_test_caseERKNS0_9callback0INS0_9ut_detail6unusedEEENS0_13basic_cstringIKcEE called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test14make_test_caseERKNS0_9callback0INS0_9ut_detail6unusedEEENS0_13basic_cstringIKcEE called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test14make_test_caseERKNS0_9callback0INS0_9ut_detail6unusedEEENS0_13basic_cstringIKcEE called 0 returned 0% blocks executed 0% function _ZN5boost9unit_test14make_test_caseERKNS0_9callback0INS0_9ut_detail6unusedEEENS0_13basic_cstringIKcEE called 0 returned 0% blocks executed 0% 42: 253:make_test_case( callback0<> const& test_func, const_string tc_name ) -: 254:{ 42: 255: return new test_case( ut_detail::normalize_test_case_name( tc_name ), test_func ); call 0 never executed call 1 never executed call 2 never executed call 3 never executed branch 4 never executed branch 5 never executed call 6 never executed call 7 never executed call 8 never executed branch 9 never executed branch 10 never executed call 11 never executed call 12 never executed call 13 never executed call 14 returned 100% call 15 returned 100% call 16 returned 100% call 17 returned 100% branch 18 taken 100% (fallthrough) branch 19 taken 0% (throw) call 20 returned 100% call 21 returned 100% call 22 returned 100% branch 23 taken 100% (fallthrough) branch 24 taken 0% (throw) call 25 returned 100% call 26 never executed call 27 never executed call 28 never executed call 29 never executed call 30 never executed call 31 never executed branch 32 never executed branch 33 never executed call 34 never executed call 35 never executed call 36 never executed branch 37 never executed branch 38 never executed call 39 never executed call 40 never executed call 41 never executed call 42 never executed call 43 never executed call 44 never executed call 45 never executed branch 46 never executed branch 47 never executed call 48 never executed call 49 never executed call 50 never executed branch 51 never executed branch 52 never executed call 53 never executed call 54 never executed call 55 never executed call 56 never executed call 57 never executed call 58 never executed call 59 never executed branch 60 never executed branch 61 never executed call 62 never executed call 63 never executed call 64 never executed branch 65 never executed branch 66 never executed call 67 never executed call 68 never executed call 69 never executed call 70 never executed call 71 never executed call 72 never executed call 73 never executed branch 74 never executed branch 75 never executed call 76 never executed call 77 never executed call 78 never executed branch 79 never executed branch 80 never executed call 81 never executed call 82 never executed call 83 never executed call 84 never executed call 85 never executed call 86 never executed call 87 never executed branch 88 never executed branch 89 never executed call 90 never executed call 91 never executed call 92 never executed branch 93 never executed branch 94 never executed call 95 never executed call 96 never executed call 97 never executed -: 256:} -: 257: -: 258://____________________________________________________________________________// -: 259: -: 260:template -: 261:inline test_case* -: 262:make_test_case( void (UserTestCase::* test_method )(), -: 263: const_string tc_name, -: 264: boost::shared_ptr user_test_case ) -: 265:{ -: 266: return new test_case( ut_detail::normalize_test_case_name( tc_name ), -: 267: ut_detail::user_tc_method_invoker( user_test_case, test_method ) ); -: 268:} -: 269: -: 270://____________________________________________________________________________// -: 271: -: 272:// ************************************************************************** // -: 273:// ************** auto_test_unit_registrar ************** // -: 274:// ************************************************************************** // -: 275: -: 276:namespace ut_detail { -: 277: -: 278:struct BOOST_TEST_DECL auto_test_unit_registrar -: 279:{ -: 280: // Constructors -: 281: auto_test_unit_registrar( test_case* tc, counter_t exp_fail ); -: 282: explicit auto_test_unit_registrar( const_string ts_name ); -: 283: explicit auto_test_unit_registrar( test_unit_generator const& tc_gen ); -: 284: explicit auto_test_unit_registrar( int ); -: 285: -: 286:private: -: 287: static std::list& curr_ts_store(); -: 288:}; -: 289: -: 290://____________________________________________________________________________// -: 291: -: 292:template -: 293:struct auto_tc_exp_fail { function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI36player_using_power_has_a_duration_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI46player_start_using_power_starts_using_power_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI39tyrosine_has_shield_as_special_power_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI22player_construction_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI25check_create_resources_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI21extract_base_works_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI44power_stop_bullets_actually_stops_bullets_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI29check_game_powers_wear_out_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI33check_game_do_action_use_power_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI40check_game_over_after_player_one_dies_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI30check_game_running_at_start_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI58check_game_players_rotation_changes_after_turning_right_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI57check_game_players_rotation_changes_after_turning_left_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI38check_game_player_bullets_do_damage_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI38check_game_player_remains_in_screen_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI56check_game_players_turn_speed_changes_with_turn_right_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI55check_game_players_turn_speed_changes_with_turn_left_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI53check_game_do_action_decellerate_undoes_accelerate_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI26check_game_bullets_move_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI34check_game_do_action_accelerate_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI45check_game_cannot_shoot_with_absent_player_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI23check_game_do_action_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI27check_create_test_game_1_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI26check_game_construction_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI23check_create_players_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI33menu_choose_for_absent_players_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI34menu_choose_for_invalid_players_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI34menu_construction_with_too_many_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI36menu_construction_with_too_little_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI23menu_choose_previous_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI19menu_choose_next_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI20menu_construction_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI17power_duration_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI17glycine_to_str_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI40get_next_and_get_prev_are_symmetrical_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI35get_prev_on_alanine_does_nothing_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI34get_next_on_valine_does_nothing_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI13check_move_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI26keep_with_speed_bullets_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI31remove_bullets_without_speed_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI41bullet_set_and_get_must_be_symmetrical_idEC2Ev called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI22bullet_construction_idEC2Ev called 1 returned 100% blocks executed 100% 42: 294: auto_tc_exp_fail() : m_value( 0 ) {} call 0 returned 100% call 1 returned 100% call 2 returned 100% call 3 returned 100% call 4 returned 100% call 5 returned 100% call 6 returned 100% call 7 returned 100% call 8 returned 100% call 9 returned 100% call 10 returned 100% call 11 returned 100% call 12 returned 100% call 13 returned 100% call 14 returned 100% call 15 returned 100% call 16 returned 100% call 17 returned 100% call 18 returned 100% call 19 returned 100% call 20 returned 100% call 21 returned 100% call 22 returned 100% call 23 returned 100% call 24 returned 100% call 25 returned 100% call 26 returned 100% call 27 returned 100% call 28 returned 100% call 29 returned 100% call 30 returned 100% call 31 returned 100% call 32 returned 100% call 33 returned 100% call 34 returned 100% call 35 returned 100% call 36 returned 100% call 37 returned 100% call 38 returned 100% call 39 returned 100% call 40 returned 100% call 41 returned 100% -: 295: -: 296: explicit auto_tc_exp_fail( unsigned v ) -: 297: : m_value( v ) -: 298: { -: 299: instance() = this; -: 300: } -: 301: function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI36player_using_power_has_a_duration_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI46player_start_using_power_starts_using_power_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI39tyrosine_has_shield_as_special_power_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI22player_construction_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI25check_create_resources_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI21extract_base_works_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI44power_stop_bullets_actually_stops_bullets_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI29check_game_powers_wear_out_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI33check_game_do_action_use_power_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI40check_game_over_after_player_one_dies_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI30check_game_running_at_start_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI58check_game_players_rotation_changes_after_turning_right_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI57check_game_players_rotation_changes_after_turning_left_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI38check_game_player_bullets_do_damage_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI38check_game_player_remains_in_screen_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI56check_game_players_turn_speed_changes_with_turn_right_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI55check_game_players_turn_speed_changes_with_turn_left_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI53check_game_do_action_decellerate_undoes_accelerate_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI26check_game_bullets_move_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI34check_game_do_action_accelerate_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI45check_game_cannot_shoot_with_absent_player_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI23check_game_do_action_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI27check_create_test_game_1_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI26check_game_construction_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI23check_create_players_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI33menu_choose_for_absent_players_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI34menu_choose_for_invalid_players_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI34menu_construction_with_too_many_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI36menu_construction_with_too_little_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI23menu_choose_previous_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI19menu_choose_next_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI20menu_construction_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI17power_duration_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI17glycine_to_str_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI40get_next_and_get_prev_are_symmetrical_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI35get_prev_on_alanine_does_nothing_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI34get_next_on_valine_does_nothing_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI13check_move_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI26keep_with_speed_bullets_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI31remove_bullets_without_speed_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI41bullet_set_and_get_must_be_symmetrical_idE8instanceEv called 1 returned 100% blocks executed 100% function _ZN5boost9unit_test9ut_detail16auto_tc_exp_failI22bullet_construction_idE8instanceEv called 1 returned 100% blocks executed 100% 42: 302: static auto_tc_exp_fail*& instance() -: 303: { 42: 304: static auto_tc_exp_fail inst; call 0 returned 100% branch 1 taken 100% (fallthrough) branch 2 taken 0% call 3 returned 100% branch 4 taken 100% (fallthrough) branch 5 taken 0% call 6 returned 100% call 7 returned 100% call 8 returned 100% call 9 returned 100% branch 10 taken 100% (fallthrough) branch 11 taken 0% call 12 returned 100% branch 13 taken 100% (fallthrough) branch 14 taken 0% call 15 returned 100% call 16 returned 100% call 17 returned 100% call 18 returned 100% branch 19 taken 100% (fallthrough) branch 20 taken 0% call 21 returned 100% branch 22 taken 100% (fallthrough) branch 23 taken 0% call 24 returned 100% call 25 returned 100% call 26 returned 100% call 27 returned 100% branch 28 taken 100% (fallthrough) branch 29 taken 0% call 30 returned 100% branch 31 taken 100% (fallthrough) branch 32 taken 0% call 33 returned 100% call 34 returned 100% call 35 returned 100% call 36 returned 100% branch 37 taken 100% (fallthrough) branch 38 taken 0% call 39 returned 100% branch 40 taken 100% (fallthrough) branch 41 taken 0% call 42 returned 100% call 43 returned 100% call 44 returned 100% call 45 returned 100% branch 46 taken 100% (fallthrough) branch 47 taken 0% call 48 returned 100% branch 49 taken 100% (fallthrough) branch 50 taken 0% call 51 returned 100% call 52 returned 100% call 53 returned 100% call 54 returned 100% branch 55 taken 100% (fallthrough) branch 56 taken 0% call 57 returned 100% branch 58 taken 100% (fallthrough) branch 59 taken 0% call 60 returned 100% call 61 returned 100% call 62 returned 100% call 63 returned 100% branch 64 taken 100% (fallthrough) branch 65 taken 0% call 66 returned 100% branch 67 taken 100% (fallthrough) branch 68 taken 0% call 69 returned 100% call 70 returned 100% call 71 returned 100% call 72 returned 100% branch 73 taken 100% (fallthrough) branch 74 taken 0% call 75 returned 100% branch 76 taken 100% (fallthrough) branch 77 taken 0% call 78 returned 100% call 79 returned 100% call 80 returned 100% call 81 returned 100% branch 82 taken 100% (fallthrough) branch 83 taken 0% call 84 returned 100% branch 85 taken 100% (fallthrough) branch 86 taken 0% call 87 returned 100% call 88 returned 100% call 89 returned 100% call 90 returned 100% branch 91 taken 100% (fallthrough) branch 92 taken 0% call 93 returned 100% branch 94 taken 100% (fallthrough) branch 95 taken 0% call 96 returned 100% call 97 returned 100% call 98 returned 100% call 99 returned 100% branch 100 taken 100% (fallthrough) branch 101 taken 0% call 102 returned 100% branch 103 taken 100% (fallthrough) branch 104 taken 0% call 105 returned 100% call 106 returned 100% call 107 returned 100% call 108 returned 100% branch 109 taken 100% (fallthrough) branch 110 taken 0% call 111 returned 100% branch 112 taken 100% (fallthrough) branch 113 taken 0% call 114 returned 100% call 115 returned 100% call 116 returned 100% call 117 returned 100% branch 118 taken 100% (fallthrough) branch 119 taken 0% call 120 returned 100% branch 121 taken 100% (fallthrough) branch 122 taken 0% call 123 returned 100% call 124 returned 100% call 125 returned 100% call 126 returned 100% branch 127 taken 100% (fallthrough) branch 128 taken 0% call 129 returned 100% branch 130 taken 100% (fallthrough) branch 131 taken 0% call 132 returned 100% call 133 returned 100% call 134 returned 100% call 135 returned 100% branch 136 taken 100% (fallthrough) branch 137 taken 0% call 138 returned 100% branch 139 taken 100% (fallthrough) branch 140 taken 0% call 141 returned 100% call 142 returned 100% call 143 returned 100% call 144 returned 100% branch 145 taken 100% (fallthrough) branch 146 taken 0% call 147 returned 100% branch 148 taken 100% (fallthrough) branch 149 taken 0% call 150 returned 100% call 151 returned 100% call 152 returned 100% call 153 returned 100% branch 154 taken 100% (fallthrough) branch 155 taken 0% call 156 returned 100% branch 157 taken 100% (fallthrough) branch 158 taken 0% call 159 returned 100% call 160 returned 100% call 161 returned 100% call 162 returned 100% branch 163 taken 100% (fallthrough) branch 164 taken 0% call 165 returned 100% branch 166 taken 100% (fallthrough) branch 167 taken 0% call 168 returned 100% call 169 returned 100% call 170 returned 100% call 171 returned 100% branch 172 taken 100% (fallthrough) branch 173 taken 0% call 174 returned 100% branch 175 taken 100% (fallthrough) branch 176 taken 0% call 177 returned 100% call 178 returned 100% call 179 returned 100% call 180 returned 100% branch 181 taken 100% (fallthrough) branch 182 taken 0% call 183 returned 100% branch 184 taken 100% (fallthrough) branch 185 taken 0% call 186 returned 100% call 187 returned 100% call 188 returned 100% call 189 returned 100% branch 190 taken 100% (fallthrough) branch 191 taken 0% call 192 returned 100% branch 193 taken 100% (fallthrough) branch 194 taken 0% call 195 returned 100% call 196 returned 100% call 197 returned 100% call 198 returned 100% branch 199 taken 100% (fallthrough) branch 200 taken 0% call 201 returned 100% branch 202 taken 100% (fallthrough) branch 203 taken 0% call 204 returned 100% call 205 returned 100% call 206 returned 100% call 207 returned 100% branch 208 taken 100% (fallthrough) branch 209 taken 0% call 210 returned 100% branch 211 taken 100% (fallthrough) branch 212 taken 0% call 213 returned 100% call 214 returned 100% call 215 returned 100% call 216 returned 100% branch 217 taken 100% (fallthrough) branch 218 taken 0% call 219 returned 100% branch 220 taken 100% (fallthrough) branch 221 taken 0% call 222 returned 100% call 223 returned 100% call 224 returned 100% call 225 returned 100% branch 226 taken 100% (fallthrough) branch 227 taken 0% call 228 returned 100% branch 229 taken 100% (fallthrough) branch 230 taken 0% call