From 1de3d397c18622b6061402fef18e625701712bc5 Mon Sep 17 00:00:00 2001
From: Dan Eble <nine.fierce.ballads@gmail.com>
Date: Sat, 8 Aug 2015 13:11:02 -0400
Subject: [PATCH] Issue 4550 (1/2) Avoid "using namespace std;" in included
 files

These are manual changes in preparation for an automated removal of
"using namespace std;".

Mostly these are additions of using-declarations for commonly used
types and containers (e.g. std::string, std::vector) to *.cc files so
that they will continue to build after the big removal.
---
 flower/file-name.cc                     |  3 +++
 flower/file-path.cc                     |  3 +++
 flower/getopt-long.cc                   |  2 ++
 flower/include/std-string.hh            |  2 +-
 flower/international.cc                 |  2 ++
 flower/interval-set.cc                  |  2 ++
 flower/interval.cc                      |  2 ++
 flower/offset.cc                        |  2 ++
 flower/polynomial.cc                    |  1 +
 flower/rational.cc                      |  2 ++
 flower/std-string.cc                    |  3 +++
 flower/string-convert.cc                |  2 ++
 flower/test-file-name.cc                |  1 +
 flower/test-file-path.cc                |  2 ++
 flower/test-interval-set.cc             |  1 +
 flower/test-std.cc                      |  1 +
 flower/test-string.cc                   |  2 ++
 flower/warn.cc                          |  2 ++
 lily/accidental-engraver.cc             |  2 ++
 lily/accidental-placement.cc            |  2 ++
 lily/accidental.cc                      |  3 +++
 lily/align-interface.cc                 |  2 ++
 lily/all-font-metrics-scheme.cc         |  2 ++
 lily/all-font-metrics.cc                |  2 ++
 lily/articulations.cc                   |  2 ++
 lily/audio-element-info.cc              |  2 ++
 lily/audio-item.cc                      |  2 ++
 lily/auto-beam-engraver.cc              |  2 ++
 lily/auto-change-iterator.cc            |  2 ++
 lily/axis-group-engraver.cc             |  2 ++
 lily/axis-group-interface-scheme.cc     |  2 ++
 lily/axis-group-interface.cc            |  5 +++++
 lily/balloon-engraver.cc                |  2 ++
 lily/bar-engraver.cc                    |  2 ++
 lily/bar-number-engraver.cc             |  2 ++
 lily/beam-collision-engraver.cc         |  2 ++
 lily/beam-quanting.cc                   |  4 ++++
 lily/beam.cc                            |  4 ++++
 lily/beaming-pattern.cc                 |  2 ++
 lily/bezier.cc                          |  2 ++
 lily/break-alignment-interface.cc       |  3 +++
 lily/break-substitution.cc              |  2 ++
 lily/change-iterator.cc                 |  2 ++
 lily/change-sequence-iterator.cc        |  2 ++
 lily/chord-name-engraver.cc             |  2 ++
 lily/chord-tremolo-engraver.cc          |  2 ++
 lily/clef-modifier.cc                   |  2 ++
 lily/clef.cc                            |  2 ++
 lily/cluster-engraver.cc                |  2 ++
 lily/cluster.cc                         |  3 +++
 lily/coherent-ligature-engraver.cc      |  2 ++
 lily/collision-engraver.cc              |  2 ++
 lily/completion-note-heads-engraver.cc  |  2 ++
 lily/completion-rest-engraver.cc        |  2 ++
 lily/concurrent-hairpin-engraver.cc     |  2 ++
 lily/constrained-breaking.cc            |  2 ++
 lily/context-def.cc                     |  4 ++++
 lily/context-specced-music-iterator.cc  |  2 ++
 lily/context.cc                         |  3 +++
 lily/control-track-performer.cc         |  2 ++
 lily/custos-engraver.cc                 |  2 ++
 lily/custos.cc                          |  2 ++
 lily/dot-column.cc                      |  3 +++
 lily/dot-formatting-problem.cc          |  2 ++
 lily/dots.cc                            |  2 ++
 lily/drum-note-engraver.cc              |  2 ++
 lily/drum-note-performer.cc             |  2 ++
 lily/duration.cc                        |  1 +
 lily/dynamic-align-engraver.cc          |  3 +++
 lily/dynamic-engraver.cc                |  2 ++
 lily/episema-engraver.cc                |  2 ++
 lily/figured-bass-engraver.cc           |  2 ++
 lily/figured-bass-position-engraver.cc  |  2 ++
 lily/file-name-map.cc                   |  3 +++
 lily/fingering-column-engraver.cc       |  2 ++
 lily/fingering-column.cc                |  2 ++
 lily/fingering-engraver.cc              |  2 ++
 lily/flag.cc                            |  2 ++
 lily/font-config-scheme.cc              |  2 ++
 lily/font-config.cc                     |  3 +++
 lily/font-metric.cc                     |  1 +
 lily/footnote-engraver.cc               |  2 ++
 lily/freetype-error.cc                  |  2 ++
 lily/fretboard-engraver.cc              |  2 ++
 lily/function-documentation.cc          |  3 +++
 lily/general-scheme.cc                  |  3 +++
 lily/glissando-engraver.cc              |  3 +++
 lily/global-context.cc                  |  2 ++
 lily/global-ctor.cc                     |  2 ++
 lily/global-vars.cc                     |  3 +++
 lily/gregorian-ligature-engraver.cc     |  2 ++
 lily/gregorian-ligature.cc              |  2 ++
 lily/grid-line-span-engraver.cc         |  2 ++
 lily/grob-array.cc                      |  1 +
 lily/grob-info.cc                       |  2 ++
 lily/grob-interface.cc                  |  2 ++
 lily/grob-pq-engraver.cc                |  2 ++
 lily/grob.cc                            |  3 +++
 lily/guile-init.cc                      |  2 ++
 lily/hara-kiri-group-spanner.cc         |  2 ++
 lily/horizontal-bracket-engraver.cc     |  2 ++
 lily/horizontal-bracket.cc              |  2 ++
 lily/includable-lexer.cc                |  2 ++
 lily/input-scheme.cc                    |  2 ++
 lily/input-smob.cc                      |  1 +
 lily/input.cc                           |  2 ++
 lily/instrument-name-engraver.cc        |  2 ++
 lily/keep-alive-together-engraver.cc    |  2 ++
 lily/key-signature-interface.cc         |  2 ++
 lily/kievan-ligature-engraver.cc        |  2 ++
 lily/laissez-vibrer-engraver.cc         |  2 ++
 lily/least-squares.cc                   |  2 ++
 lily/ledger-line-engraver.cc            |  2 ++
 lily/ledger-line-spanner.cc             |  3 +++
 lily/lexer.ll                           |  2 ++
 lily/lily-guile.cc                      |  3 +++
 lily/lily-lexer.cc                      |  2 ++
 lily/lily-parser-scheme.cc              |  2 ++
 lily/lily-parser.cc                     |  1 +
 lily/lily-version.cc                    |  2 ++
 lily/lilypond-version.cc                |  3 +++
 lily/line-interface.cc                  |  2 ++
 lily/lookup.cc                          |  2 ++
 lily/lyric-combine-music-iterator.cc    |  2 ++
 lily/lyric-engraver.cc                  |  2 ++
 lily/lyric-performer.cc                 |  2 ++
 lily/main.cc                            |  6 +++++-
 lily/melody-spanner.cc                  |  2 ++
 lily/mensural-ligature-engraver.cc      |  2 ++
 lily/mensural-ligature.cc               |  2 ++
 lily/midi-chunk.cc                      |  3 +++
 lily/midi-control-function-performer.cc |  2 ++
 lily/midi-item.cc                       |  2 ++
 lily/midi-stream.cc                     |  2 ++
 lily/misc.cc                            |  3 +++
 lily/modified-font-metric.cc            |  2 ++
 lily/moment.cc                          |  2 ++
 lily/multi-measure-rest-engraver.cc     |  2 ++
 lily/new-fingering-engraver.cc          |  2 ++
 lily/note-collision.cc                  |  2 ++
 lily/note-head.cc                       |  2 ++
 lily/note-heads-engraver.cc             |  2 ++
 lily/note-name-engraver.cc              |  3 +++
 lily/note-performer.cc                  |  2 ++
 lily/note-spacing-engraver.cc           |  2 ++
 lily/note-spacing.cc                    |  2 ++
 lily/one-line-page-breaking.cc          |  2 ++
 lily/open-type-font-scheme.cc           |  2 ++
 lily/open-type-font.cc                  |  3 +++
 lily/output-def.cc                      |  2 ++
 lily/output-property-engraver.cc        |  1 +
 lily/page-breaking.cc                   |  3 +++
 lily/page-layout-problem.cc             |  2 ++
 lily/page-spacing.cc                    |  2 ++
 lily/page-turn-engraver.cc              |  3 +++
 lily/page-turn-page-breaking.cc         |  3 +++
 lily/pango-font.cc                      |  2 ++
 lily/pango-select.cc                    |  2 ++
 lily/paper-book.cc                      |  2 ++
 lily/paper-column-engraver.cc           |  2 ++
 lily/paper-column.cc                    |  3 +++
 lily/paper-outputter-scheme.cc          |  2 ++
 lily/paper-outputter.cc                 |  1 +
 lily/paper-score.cc                     |  2 ++
 lily/parser.yy                          |  3 ++-
 lily/part-combine-part-iterator.cc      |  2 ++
 lily/percent-repeat-iterator.cc         |  2 ++
 lily/performance.cc                     |  2 ++
 lily/pfb-scheme.cc                      |  3 +++
 lily/piano-pedal-align-engraver.cc      |  2 ++
 lily/piano-pedal-engraver.cc            |  2 ++
 lily/piano-pedal-performer.cc           |  3 +++
 lily/pitch.cc                           |  2 ++
 lily/pitched-trill-engraver.cc          |  2 ++
 lily/pointer-group-interface.cc         |  2 ++
 lily/prob.cc                            |  1 +
 lily/program-option-scheme.cc           |  3 +++
 lily/program-option.cc                  |  2 ++
 lily/pure-from-neighbor-engraver.cc     |  2 ++
 lily/pure-from-neighbor-interface.cc    |  2 ++
 lily/relative-octave-check.cc           |  2 ++
 lily/relocate.cc                        |  3 +++
 lily/repeat-acknowledge-engraver.cc     |  2 ++
 lily/repeat-tie-engraver.cc             |  2 ++
 lily/rest-collision-engraver.cc         |  2 ++
 lily/rest-collision.cc                  |  2 ++
 lily/rest.cc                            |  2 ++
 lily/rhythmic-column-engraver.cc        |  2 ++
 lily/scale.cc                           |  1 +
 lily/script-column-engraver.cc          |  2 ++
 lily/script-column.cc                   |  3 +++
 lily/script-engraver.cc                 |  2 ++
 lily/script-row-engraver.cc             |  2 ++
 lily/semi-tie-column.cc                 |  2 ++
 lily/separating-line-group-engraver.cc  |  2 ++
 lily/separation-item.cc                 |  2 ++
 lily/side-position-interface.cc         |  4 ++++
 lily/simple-spacer-scheme.cc            |  2 ++
 lily/simple-spacer.cc                   |  2 ++
 lily/skyline-pair.cc                    |  2 ++
 lily/skyline.cc                         |  4 ++++
 lily/slur-configuration.cc              |  3 +++
 lily/slur-proto-engraver.cc             |  2 ++
 lily/slur-scoring.cc                    |  3 +++
 lily/slur.cc                            |  3 +++
 lily/source-file.cc                     | 11 ++++++++++-
 lily/sources.cc                         |  2 ++
 lily/spacing-determine-loose-columns.cc |  2 ++
 lily/spacing-engraver.cc                |  2 ++
 lily/spacing-interface.cc               |  2 ++
 lily/spacing-loose-columns.cc           |  2 ++
 lily/spacing-spanner.cc                 |  2 ++
 lily/span-arpeggio-engraver.cc          |  2 ++
 lily/span-bar-engraver.cc               |  2 ++
 lily/span-bar-stub-engraver.cc          |  2 ++
 lily/spanner-break-forbid-engraver.cc   |  2 ++
 lily/spanner.cc                         |  2 ++
 lily/spring.cc                          |  2 ++
 lily/staff-grouper-interface.cc         |  2 ++
 lily/staff-performer.cc                 |  4 ++++
 lily/staff-spacing.cc                   |  3 +++
 lily/staff-symbol.cc                    |  2 ++
 lily/stanza-number-align-engraver.cc    |  2 ++
 lily/stem-engraver.cc                   |  2 ++
 lily/stem-tremolo.cc                    |  2 ++
 lily/stem.cc                            |  3 +++
 lily/stencil-integral.cc                |  3 +++
 lily/stencil-scheme.cc                  |  2 ++
 lily/stencil.cc                         |  1 +
 lily/sustain-pedal.cc                   |  2 ++
 lily/system-start-delimiter-engraver.cc |  2 ++
 lily/system.cc                          |  2 ++
 lily/tab-note-heads-engraver.cc         |  2 ++
 lily/tab-tie-follow-engraver.cc         |  2 ++
 lily/template5.cc                       |  2 ++
 lily/text-engraver.cc                   |  2 ++
 lily/text-interface.cc                  |  2 ++
 lily/tie-column.cc                      |  1 +
 lily/tie-configuration.cc               |  2 ++
 lily/tie-engraver.cc                    |  2 ++
 lily/tie-formatting-problem.cc          |  4 ++++
 lily/tie-performer.cc                   |  2 ++
 lily/tie.cc                             |  2 ++
 lily/translator-group.cc                |  2 ++
 lily/translator.cc                      |  3 +++
 lily/ttf.cc                             |  3 +++
 lily/tuplet-bracket.cc                  |  2 ++
 lily/tuplet-engraver.cc                 |  2 ++
 lily/tuplet-number.cc                   |  2 ++
 lily/undead.cc                          |  2 ++
 lily/vaticana-ligature-engraver.cc      |  3 +++
 lily/vaticana-ligature.cc               |  2 ++
 lily/vertical-align-engraver.cc         |  3 +++
 lily/volta-bracket.cc                   |  2 ++
 lily/volta-repeat-iterator.cc           |  2 ++
 lily/warn-scheme.cc                     |  2 ++
 256 files changed, 566 insertions(+), 4 deletions(-)

diff --git a/flower/file-name.cc b/flower/file-name.cc
index c65d8fc7ed..71b3bf27b5 100644
--- a/flower/file-name.cc
+++ b/flower/file-name.cc
@@ -33,6 +33,9 @@ using namespace std;
 #include <sys/stat.h>
 #endif
 
+using std::string;
+using std::vector;
+
 #ifndef ROOTSEP
 #define ROOTSEP ':'
 #endif
diff --git a/flower/file-path.cc b/flower/file-path.cc
index 65cd517e5a..b2bbb286f3 100644
--- a/flower/file-path.cc
+++ b/flower/file-path.cc
@@ -41,6 +41,9 @@
 
 #include <algorithm>
 
+using std::string;
+using std::vector;
+
 vector<string>
 File_path::directories () const
 {
diff --git a/flower/getopt-long.cc b/flower/getopt-long.cc
index 9adc0c3592..49f7c8831d 100644
--- a/flower/getopt-long.cc
+++ b/flower/getopt-long.cc
@@ -36,6 +36,8 @@ gettext (char const *s)
 #include <libintl.h>
 #endif
 
+using std::string;
+
 long
 Getopt_long::get_argument_index ()
 {
diff --git a/flower/include/std-string.hh b/flower/include/std-string.hh
index 0a34d05049..bdb85795ab 100644
--- a/flower/include/std-string.hh
+++ b/flower/include/std-string.hh
@@ -36,7 +36,7 @@
 using namespace std;
 
 typedef size_t ssize;
-#define NPOS string::npos
+#define NPOS std::string::npos
 
 string to_string (const string&);
 string to_string (char c, int n = 1);
diff --git a/flower/international.cc b/flower/international.cc
index 1518182a2c..21f3ef97a1 100644
--- a/flower/international.cc
+++ b/flower/international.cc
@@ -32,6 +32,8 @@ gettext (char const *s)
 #include <libintl.h>
 #endif
 
+using std::string;
+
 string
 _ (char const *ch)
 {
diff --git a/flower/interval-set.cc b/flower/interval-set.cc
index da857f277c..acc282bbdb 100644
--- a/flower/interval-set.cc
+++ b/flower/interval-set.cc
@@ -19,6 +19,8 @@
 
 #include "interval-set.hh"
 
+using std::vector;
+
 /*
   A union of intervals in the real line.
 
diff --git a/flower/interval.cc b/flower/interval.cc
index a73da9e788..31cb3914b3 100644
--- a/flower/interval.cc
+++ b/flower/interval.cc
@@ -21,6 +21,8 @@
 
 #include "interval.tcc"
 
+using std::string;
+
 template<>
 Real
 Interval_t<Real>::infinity ()
diff --git a/flower/offset.cc b/flower/offset.cc
index 7cb2677481..2fc9bf9aa6 100644
--- a/flower/offset.cc
+++ b/flower/offset.cc
@@ -19,6 +19,8 @@
 
 #include "offset.hh"
 
+using std::string;
+
 #ifndef STANDALONE
 string
 Offset::to_string () const
diff --git a/flower/polynomial.cc b/flower/polynomial.cc
index ec8605058c..a3f679cd60 100644
--- a/flower/polynomial.cc
+++ b/flower/polynomial.cc
@@ -24,6 +24,7 @@
 #include <cmath>
 
 using namespace std;
+using std::vector;
 
 /*
   Een beter milieu begint bij uzelf. Hergebruik!
diff --git a/flower/rational.cc b/flower/rational.cc
index 559e1646a0..e93f65112e 100644
--- a/flower/rational.cc
+++ b/flower/rational.cc
@@ -27,6 +27,8 @@ using namespace std;
 #include "string-convert.hh"
 #include "libc-extension.hh"
 
+using std::string;
+
 double
 Rational::to_double () const
 {
diff --git a/flower/std-string.cc b/flower/std-string.cc
index 593a286d84..b03d3cca59 100644
--- a/flower/std-string.cc
+++ b/flower/std-string.cc
@@ -21,6 +21,9 @@
 #include "string-convert.hh"
 #include "std-vector.hh"
 
+using std::string;
+using std::vector;
+
 string
 to_string (const string &s)
 {
diff --git a/flower/string-convert.cc b/flower/string-convert.cc
index e3e8bc824d..13788a4a84 100644
--- a/flower/string-convert.cc
+++ b/flower/string-convert.cc
@@ -14,6 +14,8 @@ using namespace std;
 #include "rational.hh"
 #include "std-vector.hh"
 
+using std::string;
+
 /**
    A safe length for stringconversion buffers.
 
diff --git a/flower/test-file-name.cc b/flower/test-file-name.cc
index adbaa52913..04ee34b51f 100644
--- a/flower/test-file-name.cc
+++ b/flower/test-file-name.cc
@@ -3,6 +3,7 @@
 #include "yaffut-parameters.hh"
 
 using namespace std;
+using std::string;
 
 string slashify (string file_name);
 
diff --git a/flower/test-file-path.cc b/flower/test-file-path.cc
index a20364b98c..e55309a3f7 100644
--- a/flower/test-file-path.cc
+++ b/flower/test-file-path.cc
@@ -6,6 +6,8 @@
 #include "yaffut.hh"
 #include "config.hh"
 
+using std::string;
+
 TEST (File_path, Find)
 {
   char const *extensions[] = {"ly", "", 0};
diff --git a/flower/test-interval-set.cc b/flower/test-interval-set.cc
index 5b4d1f637e..6d8d3823d3 100644
--- a/flower/test-interval-set.cc
+++ b/flower/test-interval-set.cc
@@ -22,6 +22,7 @@
 #include "yaffut.hh"
 
 using namespace std;
+using std::vector;
 
 FUNC (interval_set_union)
 {
diff --git a/flower/test-std.cc b/flower/test-std.cc
index 4add05a625..711e9237b6 100644
--- a/flower/test-std.cc
+++ b/flower/test-std.cc
@@ -7,6 +7,7 @@
 #include "yaffut.hh"
 
 using namespace std;
+using std::vector;
 
 template<typename T>
 void
diff --git a/flower/test-string.cc b/flower/test-string.cc
index 1967d43751..f5524bba74 100644
--- a/flower/test-string.cc
+++ b/flower/test-string.cc
@@ -6,6 +6,8 @@
 #include "yaffut.hh"
 
 using namespace std;
+using std::string;
+using std::vector;
 
 FUNC (string_split_join)
 {
diff --git a/flower/warn.cc b/flower/warn.cc
index f17a36483f..422dea8027 100644
--- a/flower/warn.cc
+++ b/flower/warn.cc
@@ -26,6 +26,8 @@
 #include "international.hh"
 
 using namespace std;
+using std::string;
+using std::vector;
 
 /** We have several different loglevels, each with its own message function(s):
       ERROR: error, non_fatal_error, programming_error
diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc
index f9d2e15cd4..91984b3802 100644
--- a/lily/accidental-engraver.cc
+++ b/lily/accidental-engraver.cc
@@ -37,6 +37,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Accidental_entry
 {
 public:
diff --git a/lily/accidental-placement.cc b/lily/accidental-placement.cc
index 1a55710122..45c9fe08e3 100644
--- a/lily/accidental-placement.cc
+++ b/lily/accidental-placement.cc
@@ -31,6 +31,8 @@
 #include "stream-event.hh"
 #include "warn.hh"
 
+using std::vector;
+
 static Pitch *
 accidental_pitch (Grob *acc)
 {
diff --git a/lily/accidental.cc b/lily/accidental.cc
index 4343c2dc5a..00ce8786d1 100644
--- a/lily/accidental.cc
+++ b/lily/accidental.cc
@@ -28,6 +28,9 @@
 #include "system.hh"
 #include "skyline-pair.hh"
 
+using std::string;
+using std::vector;
+
 Stencil
 parenthesize (Grob *me, Stencil m)
 {
diff --git a/lily/align-interface.cc b/lily/align-interface.cc
index 80a9dd3c08..fed8f39746 100644
--- a/lily/align-interface.cc
+++ b/lily/align-interface.cc
@@ -32,6 +32,8 @@
 #include "system.hh"
 #include "warn.hh"
 
+using std::vector;
+
 MAKE_SCHEME_CALLBACK (Align_interface, align_to_minimum_distances, 1);
 SCM
 Align_interface::align_to_minimum_distances (SCM smob)
diff --git a/lily/all-font-metrics-scheme.cc b/lily/all-font-metrics-scheme.cc
index b29ea4bf4b..1de6b0e03a 100644
--- a/lily/all-font-metrics-scheme.cc
+++ b/lily/all-font-metrics-scheme.cc
@@ -22,6 +22,8 @@
 #include "main.hh"
 #include "protected-scm.hh"
 
+using std::string;
+
 All_font_metrics *all_fonts_global = 0;
 Protected_scm all_fonts_global_scm;
 
diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc
index ca3703369a..13542022c3 100644
--- a/lily/all-font-metrics.cc
+++ b/lily/all-font-metrics.cc
@@ -27,6 +27,8 @@
 #include "scm-hash.hh"
 #include "warn.hh"
 
+using std::string;
+
 Index_to_charcode_map const *
 All_font_metrics::get_index_to_charcode_map (const string &filename,
                                              int face_index,
diff --git a/lily/articulations.cc b/lily/articulations.cc
index 334e438682..5b1bcfd68e 100644
--- a/lily/articulations.cc
+++ b/lily/articulations.cc
@@ -23,6 +23,8 @@
 #include "warn.hh"
 #include "context.hh"
 
+using std::vector;
+
 /*
   Return an articulation list given a note_events vector and an
   articulation_events vector.
diff --git a/lily/audio-element-info.cc b/lily/audio-element-info.cc
index 6e6b7a54e6..de69162ef0 100644
--- a/lily/audio-element-info.cc
+++ b/lily/audio-element-info.cc
@@ -22,6 +22,8 @@
 #include "translator-group.hh"
 #include "context.hh"
 
+using std::vector;
+
 Audio_element_info::Audio_element_info (Audio_element *s, Stream_event *r)
 {
   elem_ = s;
diff --git a/lily/audio-item.cc b/lily/audio-item.cc
index 97a15d552a..5f1814f98e 100644
--- a/lily/audio-item.cc
+++ b/lily/audio-item.cc
@@ -22,6 +22,8 @@
 #include "midi-item.hh"
 #include "audio-column.hh"
 
+using std::string;
+
 Audio_instrument::Audio_instrument (string instrument_string)
 {
   str_ = instrument_string;
diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc
index 7500ec9ef0..c1be5d985f 100644
--- a/lily/auto-beam-engraver.cc
+++ b/lily/auto-beam-engraver.cc
@@ -33,6 +33,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Auto_beam_engraver : public Engraver
 {
   TRANSLATOR_DECLARATIONS (Auto_beam_engraver);
diff --git a/lily/auto-change-iterator.cc b/lily/auto-change-iterator.cc
index 55ff27d316..bc4b69b487 100644
--- a/lily/auto-change-iterator.cc
+++ b/lily/auto-change-iterator.cc
@@ -20,6 +20,8 @@
 #include "change-iterator.hh"
 #include "change-sequence-iterator.hh"
 
+using std::string;
+
 class Auto_change_iterator : public Change_sequence_iterator
 {
 public:
diff --git a/lily/axis-group-engraver.cc b/lily/axis-group-engraver.cc
index 3a9b0d6775..f33770f313 100644
--- a/lily/axis-group-engraver.cc
+++ b/lily/axis-group-engraver.cc
@@ -29,6 +29,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 /**
    Put stuff in a Spanner with an Axis_group_interface.
    Use as last element of a context.
diff --git a/lily/axis-group-interface-scheme.cc b/lily/axis-group-interface-scheme.cc
index ed47496fde..eff617d8b4 100644
--- a/lily/axis-group-interface-scheme.cc
+++ b/lily/axis-group-interface-scheme.cc
@@ -22,6 +22,8 @@
 #include "grob.hh"
 #include "grob-array.hh"
 
+using std::vector;
+
 LY_DEFINE (ly_relative_group_extent, "ly:relative-group-extent",
            3, 0, 0, (SCM elements, SCM common, SCM axis),
            "Determine the extent of @var{elements} relative to @var{common} in the"
diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc
index e842cb6d80..7c11cb7e97 100644
--- a/lily/axis-group-interface.cc
+++ b/lily/axis-group-interface.cc
@@ -40,6 +40,11 @@
 #include "warn.hh"
 #include "unpure-pure-container.hh"
 
+using std::multimap;
+using std::pair;
+using std::string;
+using std::vector;
+
 static bool
 pure_staff_priority_less (Grob *const &g1, Grob *const &g2);
 
diff --git a/lily/balloon-engraver.cc b/lily/balloon-engraver.cc
index 980aa92231..813b370be7 100644
--- a/lily/balloon-engraver.cc
+++ b/lily/balloon-engraver.cc
@@ -24,6 +24,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Balloon_engraver : public Engraver
 {
   TRANSLATOR_DECLARATIONS (Balloon_engraver);
diff --git a/lily/bar-engraver.cc b/lily/bar-engraver.cc
index 397743b4b0..cab5e6ee16 100644
--- a/lily/bar-engraver.cc
+++ b/lily/bar-engraver.cc
@@ -26,6 +26,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 /*
   generate bars. Either user ("|:"), or default (new measure)
 */
diff --git a/lily/bar-number-engraver.cc b/lily/bar-number-engraver.cc
index 144076439c..25373327be 100644
--- a/lily/bar-number-engraver.cc
+++ b/lily/bar-number-engraver.cc
@@ -29,6 +29,8 @@
 
 #include "translator.icc"
 
+using std::string;
+
 /*
   TODO: detect the top staff (stavesFound), and acknowledge staff-group
   system-start-delims. If we find these, and the top staff is in the
diff --git a/lily/beam-collision-engraver.cc b/lily/beam-collision-engraver.cc
index 151ffacf16..006db81d93 100644
--- a/lily/beam-collision-engraver.cc
+++ b/lily/beam-collision-engraver.cc
@@ -24,6 +24,8 @@
 #include "pointer-group-interface.hh"
 #include "stem.hh"
 
+using std::vector;
+
 class Beam_collision_engraver : public Engraver
 {
 protected:
diff --git a/lily/beam-quanting.cc b/lily/beam-quanting.cc
index f3505772f1..740f286908 100644
--- a/lily/beam-quanting.cc
+++ b/lily/beam-quanting.cc
@@ -47,6 +47,10 @@ using namespace std;
 #include "warn.hh"
 #include "string-convert.hh"
 
+using std::set;
+using std::string;
+using std::vector;
+
 Real
 get_detail (SCM alist, SCM sym, Real def)
 {
diff --git a/lily/beam.cc b/lily/beam.cc
index 206f6e9f4d..6bdaab9d9f 100644
--- a/lily/beam.cc
+++ b/lily/beam.cc
@@ -66,6 +66,10 @@
 
 #include <map>
 
+using std::map;
+using std::string;
+using std::vector;
+
 Beam_stem_segment::Beam_stem_segment ()
 {
   max_connect_ = 1000;          // infinity
diff --git a/lily/beaming-pattern.cc b/lily/beaming-pattern.cc
index f205df8d78..5510965c31 100644
--- a/lily/beaming-pattern.cc
+++ b/lily/beaming-pattern.cc
@@ -21,6 +21,8 @@
 #include "beaming-pattern.hh"
 #include "misc.hh"
 
+using std::vector;
+
 /*
   Represents a stem belonging to a beam. Sometimes (for example, if the stem
   belongs to a rest and stemlets aren't used) the stem will be invisible.
diff --git a/lily/bezier.cc b/lily/bezier.cc
index b202d45dd6..e2c099b31b 100644
--- a/lily/bezier.cc
+++ b/lily/bezier.cc
@@ -21,6 +21,8 @@
 #include "warn.hh"
 #include "libc-extension.hh"
 
+using std::vector;
+
 Real binomial_coefficient_3[]
 =
 {
diff --git a/lily/break-alignment-interface.cc b/lily/break-alignment-interface.cc
index e2a546f6a6..4b1e06d98c 100644
--- a/lily/break-alignment-interface.cc
+++ b/lily/break-alignment-interface.cc
@@ -29,6 +29,9 @@
 #include "side-position-interface.hh"
 #include "warn.hh"
 
+using std::string;
+using std::vector;
+
 /*
   This is tricky: we cannot modify 'elements, since callers are
   iterating the same list. Reordering the list in-place, or resetting
diff --git a/lily/break-substitution.cc b/lily/break-substitution.cc
index d198753d67..33d5d4c9c5 100644
--- a/lily/break-substitution.cc
+++ b/lily/break-substitution.cc
@@ -25,6 +25,8 @@ using namespace std;
 #include "system.hh"
 #include "grob-array.hh"
 
+using std::vector;
+
 static SCM break_criterion;
 void
 set_break_subsititution (SCM criterion)
diff --git a/lily/change-iterator.cc b/lily/change-iterator.cc
index 0f8823d484..f192e0c08f 100644
--- a/lily/change-iterator.cc
+++ b/lily/change-iterator.cc
@@ -25,6 +25,8 @@
 #include "music.hh"
 #include "warn.hh"
 
+using std::string;
+
 void
 Change_iterator::error (const string &reason)
 {
diff --git a/lily/change-sequence-iterator.cc b/lily/change-sequence-iterator.cc
index 02ed77dd06..f8a0cfd93b 100644
--- a/lily/change-sequence-iterator.cc
+++ b/lily/change-sequence-iterator.cc
@@ -21,6 +21,8 @@
 #include "context.hh"
 #include "music.hh"
 
+using std::string;
+
 Change_sequence_iterator::Change_sequence_iterator () :
   change_list_(SCM_EOL)
 {
diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc
index db8493e2a5..bec242fdc7 100644
--- a/lily/chord-name-engraver.cc
+++ b/lily/chord-name-engraver.cc
@@ -32,6 +32,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Chord_name_engraver : public Engraver
 {
   TRANSLATOR_DECLARATIONS (Chord_name_engraver);
diff --git a/lily/chord-tremolo-engraver.cc b/lily/chord-tremolo-engraver.cc
index 3855c350d7..9de2bbffc8 100644
--- a/lily/chord-tremolo-engraver.cc
+++ b/lily/chord-tremolo-engraver.cc
@@ -34,6 +34,8 @@
 
 #include "translator.icc"
 
+using std::string;
+
 /**
 
 This acknowledges repeated music with "tremolo" style.  It typesets
diff --git a/lily/clef-modifier.cc b/lily/clef-modifier.cc
index c6ce950fc0..480c6fa7b3 100644
--- a/lily/clef-modifier.cc
+++ b/lily/clef-modifier.cc
@@ -19,6 +19,8 @@
 
 #include "item.hh"
 
+using std::string;
+
 struct Clef_modifier
 {
   DECLARE_SCHEME_CALLBACK (calc_parent_alignment, (SCM));
diff --git a/lily/clef.cc b/lily/clef.cc
index 6f9062190e..fe860c2ee4 100644
--- a/lily/clef.cc
+++ b/lily/clef.cc
@@ -24,6 +24,8 @@
 #include "item.hh"
 #include "stencil.hh"
 
+using std::string;
+
 MAKE_SCHEME_CALLBACK (Clef, calc_glyph_name, 1);
 SCM
 Clef::calc_glyph_name (SCM smob)
diff --git a/lily/cluster-engraver.cc b/lily/cluster-engraver.cc
index bb5ed0dc54..c934fd0ba3 100644
--- a/lily/cluster-engraver.cc
+++ b/lily/cluster-engraver.cc
@@ -29,6 +29,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Cluster_spanner_engraver : public Engraver
 {
 
diff --git a/lily/cluster.cc b/lily/cluster.cc
index 9c160fd8cc..d7f106964f 100644
--- a/lily/cluster.cc
+++ b/lily/cluster.cc
@@ -29,6 +29,9 @@
 #include "staff-symbol-referencer.hh"
 #include "warn.hh"
 
+using std::string;
+using std::vector;
+
 /*
   TODO: Add support for cubic spline segments.
  */
diff --git a/lily/coherent-ligature-engraver.cc b/lily/coherent-ligature-engraver.cc
index 2ba9eeca85..e50ac01fd3 100644
--- a/lily/coherent-ligature-engraver.cc
+++ b/lily/coherent-ligature-engraver.cc
@@ -27,6 +27,8 @@
 #include "staff-symbol-referencer.hh"
 #include "stream-event.hh"
 
+using std::vector;
+
 /*
  * This abstract class serves as common superclass for all ligature
  * engravers thet produce a single connected graphical object of fixed
diff --git a/lily/collision-engraver.cc b/lily/collision-engraver.cc
index d1eb2dd3c0..8526b94b50 100644
--- a/lily/collision-engraver.cc
+++ b/lily/collision-engraver.cc
@@ -25,6 +25,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Collision_engraver : public Engraver
 {
   Item *col_;
diff --git a/lily/completion-note-heads-engraver.cc b/lily/completion-note-heads-engraver.cc
index c88e4cccc1..f5abe73e43 100644
--- a/lily/completion-note-heads-engraver.cc
+++ b/lily/completion-note-heads-engraver.cc
@@ -39,6 +39,8 @@ using namespace std;
 
 #include "translator.icc"
 
+using std::vector;
+
 /*
   How does this work?
 
diff --git a/lily/completion-rest-engraver.cc b/lily/completion-rest-engraver.cc
index 8f809fde70..b7e76c82bc 100644
--- a/lily/completion-rest-engraver.cc
+++ b/lily/completion-rest-engraver.cc
@@ -40,6 +40,8 @@ using namespace std;
 
 #include "translator.icc"
 
+using std::vector;
+
 /*
   How does this work?
 
diff --git a/lily/concurrent-hairpin-engraver.cc b/lily/concurrent-hairpin-engraver.cc
index aa167b7de4..2b36e7a25a 100644
--- a/lily/concurrent-hairpin-engraver.cc
+++ b/lily/concurrent-hairpin-engraver.cc
@@ -28,6 +28,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Concurrent_hairpin_engraver : public Engraver
 {
 public:
diff --git a/lily/constrained-breaking.cc b/lily/constrained-breaking.cc
index df08d5433c..463e84bf11 100644
--- a/lily/constrained-breaking.cc
+++ b/lily/constrained-breaking.cc
@@ -29,6 +29,8 @@
 #include "system.hh"
 #include "warn.hh"
 
+using std::vector;
+
 /*
   We use the following optimal substructure. Let W (A) be our weight function.
 
diff --git a/lily/context-def.cc b/lily/context-def.cc
index 3258297b49..762a7f952e 100644
--- a/lily/context-def.cc
+++ b/lily/context-def.cc
@@ -29,6 +29,10 @@
 #include "translator.hh"
 #include "warn.hh"
 
+using std::set;
+using std::string;
+using std::vector;
+
 Context_def::Context_def ()
 {
   context_aliases_ = SCM_EOL;
diff --git a/lily/context-specced-music-iterator.cc b/lily/context-specced-music-iterator.cc
index 1a27d2a93d..ee09d1e0f3 100644
--- a/lily/context-specced-music-iterator.cc
+++ b/lily/context-specced-music-iterator.cc
@@ -21,6 +21,8 @@
 #include "context.hh"
 #include "music.hh"
 
+using std::string;
+
 class Context_specced_music_iterator : public Music_wrapper_iterator
 {
 public:
diff --git a/lily/context.cc b/lily/context.cc
index ef6fecf4b1..7892236010 100644
--- a/lily/context.cc
+++ b/lily/context.cc
@@ -32,6 +32,9 @@
 #include "warn.hh"
 #include "lily-imports.hh"
 
+using std::string;
+using std::vector;
+
 bool
 Context::is_removable () const
 {
diff --git a/lily/control-track-performer.cc b/lily/control-track-performer.cc
index 82beebe122..2bf71f30d5 100644
--- a/lily/control-track-performer.cc
+++ b/lily/control-track-performer.cc
@@ -9,6 +9,8 @@
 
 #include "translator.icc"
 
+using std::string;
+
 class Control_track_performer : public Performer
 {
   Audio_staff *control_track_;
diff --git a/lily/custos-engraver.cc b/lily/custos-engraver.cc
index 5893dc205b..0f94d95e07 100644
--- a/lily/custos-engraver.cc
+++ b/lily/custos-engraver.cc
@@ -28,6 +28,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 /*
  * This class implements an engraver for custos symbols.
  *
diff --git a/lily/custos.cc b/lily/custos.cc
index 37aeb66f6b..3ba5db834e 100644
--- a/lily/custos.cc
+++ b/lily/custos.cc
@@ -37,6 +37,8 @@ using namespace std;
 #include "staff-symbol-referencer.hh"
 #include "warn.hh"
 
+using std::string;
+
 MAKE_SCHEME_CALLBACK (Custos, print, 1);
 SCM
 Custos::print (SCM smob)
diff --git a/lily/dot-column.cc b/lily/dot-column.cc
index 7ac3140141..84ace8228f 100644
--- a/lily/dot-column.cc
+++ b/lily/dot-column.cc
@@ -39,6 +39,9 @@ using namespace std;
 #include "staff-symbol-referencer.hh"
 #include "stem.hh"
 
+using std::set;
+using std::vector;
+
 MAKE_SCHEME_CALLBACK (Dot_column, calc_positioning_done, 1);
 SCM
 Dot_column::calc_positioning_done (SCM smob)
diff --git a/lily/dot-formatting-problem.cc b/lily/dot-formatting-problem.cc
index 221ab584b4..81f0022acd 100644
--- a/lily/dot-formatting-problem.cc
+++ b/lily/dot-formatting-problem.cc
@@ -21,6 +21,8 @@
 #include "dot-configuration.hh"
 #include "skyline.hh"
 
+using std::vector;
+
 Dot_formatting_problem::~Dot_formatting_problem ()
 {
   delete best_;
diff --git a/lily/dots.cc b/lily/dots.cc
index b7f787bc02..dd2230a797 100644
--- a/lily/dots.cc
+++ b/lily/dots.cc
@@ -26,6 +26,8 @@
 #include "staff-symbol-referencer.hh"
 #include "international.hh"
 
+using std::string;
+
 MAKE_SCHEME_CALLBACK (Dots, print, 1);
 SCM
 Dots::print (SCM d)
diff --git a/lily/drum-note-engraver.cc b/lily/drum-note-engraver.cc
index 09a58fa24b..40e3aaf936 100644
--- a/lily/drum-note-engraver.cc
+++ b/lily/drum-note-engraver.cc
@@ -33,6 +33,8 @@ using namespace std;
 
 #include "translator.icc"
 
+using std::vector;
+
 class Drum_notes_engraver : public Engraver
 {
   vector<Item *> scripts_;
diff --git a/lily/drum-note-performer.cc b/lily/drum-note-performer.cc
index 0285de6504..f8225d22ed 100644
--- a/lily/drum-note-performer.cc
+++ b/lily/drum-note-performer.cc
@@ -25,6 +25,8 @@
 #include "translator.icc"
 #include "warn.hh"
 
+using std::vector;
+
 class Drum_note_performer : public Performer
 {
 public:
diff --git a/lily/duration.cc b/lily/duration.cc
index 0b10019540..37b702183c 100644
--- a/lily/duration.cc
+++ b/lily/duration.cc
@@ -23,6 +23,7 @@
 #include "misc.hh"
 #include "lily-proto.hh"
 
+using std::string;
 
 int
 Duration::compare (Duration const &left, Duration const &right)
diff --git a/lily/dynamic-align-engraver.cc b/lily/dynamic-align-engraver.cc
index 0abb39a7f2..56a90e5e16 100644
--- a/lily/dynamic-align-engraver.cc
+++ b/lily/dynamic-align-engraver.cc
@@ -31,6 +31,9 @@
 
 #include "translator.icc"
 
+using std::set;
+using std::vector;
+
 class Dynamic_align_engraver : public Engraver
 {
   TRANSLATOR_DECLARATIONS (Dynamic_align_engraver);
diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc
index edfd35fcb5..ca81388226 100644
--- a/lily/dynamic-engraver.cc
+++ b/lily/dynamic-engraver.cc
@@ -30,6 +30,8 @@
 
 #include "translator.icc"
 
+using std::string;
+
 class Dynamic_engraver : public Engraver
 {
   TRANSLATOR_DECLARATIONS (Dynamic_engraver);
diff --git a/lily/episema-engraver.cc b/lily/episema-engraver.cc
index a62ed3726f..ec33c180cc 100644
--- a/lily/episema-engraver.cc
+++ b/lily/episema-engraver.cc
@@ -27,6 +27,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Episema_engraver : public Engraver
 {
 public:
diff --git a/lily/figured-bass-engraver.cc b/lily/figured-bass-engraver.cc
index 2ed07e3e83..5463be534d 100644
--- a/lily/figured-bass-engraver.cc
+++ b/lily/figured-bass-engraver.cc
@@ -32,6 +32,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 struct Figure_group
 {
   Spanner *group_;
diff --git a/lily/figured-bass-position-engraver.cc b/lily/figured-bass-position-engraver.cc
index c1df4623e6..faf356052b 100644
--- a/lily/figured-bass-position-engraver.cc
+++ b/lily/figured-bass-position-engraver.cc
@@ -27,6 +27,8 @@
 #include "translator.icc"
 #include "axis-group-interface.hh"
 
+using std::vector;
+
 class Figured_bass_position_engraver : public Engraver
 {
   TRANSLATOR_DECLARATIONS (Figured_bass_position_engraver);
diff --git a/lily/file-name-map.cc b/lily/file-name-map.cc
index 6266aec3c3..d9b9711ba1 100644
--- a/lily/file-name-map.cc
+++ b/lily/file-name-map.cc
@@ -23,6 +23,9 @@ using namespace std;
 #include "file-name-map.hh"
 #include "lily-guile.hh"
 
+using std::map;
+using std::string;
+
 map<string, string> file_name_map_global;
 
 string
diff --git a/lily/fingering-column-engraver.cc b/lily/fingering-column-engraver.cc
index 1c5b904809..9444e2cf0a 100644
--- a/lily/fingering-column-engraver.cc
+++ b/lily/fingering-column-engraver.cc
@@ -25,6 +25,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 /**
    Find potentially colliding scripts, and put them in a
    Fingering_column, that will fix the columns.  */
diff --git a/lily/fingering-column.cc b/lily/fingering-column.cc
index c9db28baf9..a2e6f38a6d 100644
--- a/lily/fingering-column.cc
+++ b/lily/fingering-column.cc
@@ -25,6 +25,8 @@
 #include "item.hh"
 #include "paper-column.hh"
 
+using std::vector;
+
 #define EPS 1e-5
 
 struct Fingering_and_offset
diff --git a/lily/fingering-engraver.cc b/lily/fingering-engraver.cc
index d5b4102d8b..f6a10d4b12 100644
--- a/lily/fingering-engraver.cc
+++ b/lily/fingering-engraver.cc
@@ -28,6 +28,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Fingering_engraver : public Engraver
 {
   vector<Stream_event *> events_;
diff --git a/lily/flag.cc b/lily/flag.cc
index 4b90be8be0..2a67156575 100644
--- a/lily/flag.cc
+++ b/lily/flag.cc
@@ -29,6 +29,8 @@
 #include "stencil.hh"
 #include "warn.hh"
 
+using std::string;
+
 class Flag
 {
 public:
diff --git a/lily/font-config-scheme.cc b/lily/font-config-scheme.cc
index a2bc3ae5d0..139754f8b5 100644
--- a/lily/font-config-scheme.cc
+++ b/lily/font-config-scheme.cc
@@ -25,6 +25,8 @@
 
 #include <fontconfig/fontconfig.h>
 
+using std::string;
+
 string
 display_fontset (FcFontSet *fs)
 {
diff --git a/lily/font-config.cc b/lily/font-config.cc
index 74e591254f..2caa9e890e 100644
--- a/lily/font-config.cc
+++ b/lily/font-config.cc
@@ -30,6 +30,9 @@
 #include "main.hh"
 #include "warn.hh"
 
+using std::string;
+using std::vector;
+
 FcConfig *font_config_global = 0;
 
 void
diff --git a/lily/font-metric.cc b/lily/font-metric.cc
index f2b6a0e147..73104615a0 100644
--- a/lily/font-metric.cc
+++ b/lily/font-metric.cc
@@ -29,6 +29,7 @@ using namespace std;
 #include "stencil.hh"
 #include "warn.hh"
 
+using std::string;
 
 Real
 Font_metric::design_size () const
diff --git a/lily/footnote-engraver.cc b/lily/footnote-engraver.cc
index 636379125f..8789718c64 100644
--- a/lily/footnote-engraver.cc
+++ b/lily/footnote-engraver.cc
@@ -29,6 +29,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Footnote_engraver : public Engraver
 {
   TRANSLATOR_DECLARATIONS (Footnote_engraver);
diff --git a/lily/freetype-error.cc b/lily/freetype-error.cc
index 8846b4d041..dedb246b27 100644
--- a/lily/freetype-error.cc
+++ b/lily/freetype-error.cc
@@ -37,6 +37,8 @@ const struct Freetype_error_message
 
 #include <string>
 
+using std::string;
+
 string
 freetype_error_string (FT_Error code)
 {
diff --git a/lily/fretboard-engraver.cc b/lily/fretboard-engraver.cc
index 2ce799bf0f..5ce6763cb7 100644
--- a/lily/fretboard-engraver.cc
+++ b/lily/fretboard-engraver.cc
@@ -31,6 +31,8 @@ using namespace std;
 
 #include "translator.icc"
 
+using std::vector;
+
 /**
    make (guitar-like) tablature note
 */
diff --git a/lily/function-documentation.cc b/lily/function-documentation.cc
index 756f174512..e04188c7b5 100644
--- a/lily/function-documentation.cc
+++ b/lily/function-documentation.cc
@@ -37,6 +37,9 @@ using namespace std;
 #include "stream-event.hh"
 #include "unpure-pure-container.hh"
 
+using std::map;
+using std::string;
+
 static SCM doc_hash_table;
 
 void
diff --git a/lily/general-scheme.cc b/lily/general-scheme.cc
index d5fe89024c..de5a2cc225 100644
--- a/lily/general-scheme.cc
+++ b/lily/general-scheme.cc
@@ -40,6 +40,9 @@ using namespace std;
 #include "version.hh"
 #include "warn.hh"
 
+using std::string;
+using std::vector;
+
 /* Declaration of log function(s) */
 SCM ly_progress (SCM, SCM);
 
diff --git a/lily/glissando-engraver.cc b/lily/glissando-engraver.cc
index c7744d1f4b..ca7b413230 100644
--- a/lily/glissando-engraver.cc
+++ b/lily/glissando-engraver.cc
@@ -29,6 +29,9 @@
 
 #include "translator.icc"
 
+using std::string;
+using std::vector;
+
 class Glissando_engraver : public Engraver
 {
 public:
diff --git a/lily/global-context.cc b/lily/global-context.cc
index c21deb3b9b..72ccc5be89 100644
--- a/lily/global-context.cc
+++ b/lily/global-context.cc
@@ -30,6 +30,8 @@ using namespace std;
 #include "output-def.hh"
 #include "warn.hh"
 
+using std::string;
+
 Global_context::Global_context (Output_def *o)
   : Context ()
 {
diff --git a/lily/global-ctor.cc b/lily/global-ctor.cc
index 908a611e0c..8c224d29fd 100644
--- a/lily/global-ctor.cc
+++ b/lily/global-ctor.cc
@@ -21,6 +21,8 @@
 
 #include "std-vector.hh"
 
+using std::vector;
+
 static vector<Global_ctor> *ctor_global_statics_;
 
 void
diff --git a/lily/global-vars.cc b/lily/global-vars.cc
index dce813691a..dcbbdfedf6 100644
--- a/lily/global-vars.cc
+++ b/lily/global-vars.cc
@@ -20,6 +20,9 @@
 #include "file-path.hh"
 #include "main.hh"
 
+using std::string;
+using std::vector;
+
 /*
  * Global options that can be overridden through command line.
  */
diff --git a/lily/gregorian-ligature-engraver.cc b/lily/gregorian-ligature-engraver.cc
index 4e4fc135c4..90791894bb 100644
--- a/lily/gregorian-ligature-engraver.cc
+++ b/lily/gregorian-ligature-engraver.cc
@@ -31,6 +31,8 @@
 /* ASSIGN_EVENT_ONCE */
 #include "translator.icc"
 
+using std::vector;
+
 /*
  * This abstract class is the common superclass for all ligature
  * engravers for Gregorian chant notation.  It cares for the musical
diff --git a/lily/gregorian-ligature.cc b/lily/gregorian-ligature.cc
index 6fbbd0927b..2243bc6d26 100644
--- a/lily/gregorian-ligature.cc
+++ b/lily/gregorian-ligature.cc
@@ -21,6 +21,8 @@
 
 #include "grob.hh"
 
+using std::string;
+
 void check_prefix (const string &name, int mask, int prefix_set, string *str)
 {
   if (prefix_set & mask)
diff --git a/lily/grid-line-span-engraver.cc b/lily/grid-line-span-engraver.cc
index a61f61df78..899e1fbd4e 100644
--- a/lily/grid-line-span-engraver.cc
+++ b/lily/grid-line-span-engraver.cc
@@ -23,6 +23,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Grid_line_span_engraver : public Engraver
 {
   Item *spanline_;
diff --git a/lily/grob-array.cc b/lily/grob-array.cc
index ec0ee43e18..9e45901c8d 100644
--- a/lily/grob-array.cc
+++ b/lily/grob-array.cc
@@ -21,6 +21,7 @@
 #include "item.hh"
 #include "spanner.hh"
 
+using std::vector;
 
 Item *
 Grob_array::item (vsize i)
diff --git a/lily/grob-info.cc b/lily/grob-info.cc
index ef991418a1..fa4b63c8cb 100644
--- a/lily/grob-info.cc
+++ b/lily/grob-info.cc
@@ -25,6 +25,8 @@
 #include "stream-event.hh"
 #include "translator-group.hh"
 
+using std::vector;
+
 Grob_info::Grob_info (Translator *t, Grob *g)
 {
   origin_trans_ = t;
diff --git a/lily/grob-interface.cc b/lily/grob-interface.cc
index ea9b81ad9f..1dfd0f2c9e 100644
--- a/lily/grob-interface.cc
+++ b/lily/grob-interface.cc
@@ -26,6 +26,8 @@
 #include "warn.hh"
 #include "misc.hh"
 
+using std::string;
+
 SCM add_interface (char const *cxx_name,
                    char const *descr,
                    char const *vars)
diff --git a/lily/grob-pq-engraver.cc b/lily/grob-pq-engraver.cc
index 45b4ff2b35..d3cd356a04 100644
--- a/lily/grob-pq-engraver.cc
+++ b/lily/grob-pq-engraver.cc
@@ -24,6 +24,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 struct Grob_pq_entry
 {
   Grob *grob_;
diff --git a/lily/grob.cc b/lily/grob.cc
index 2f1bd8aa9f..369135d2b2 100644
--- a/lily/grob.cc
+++ b/lily/grob.cc
@@ -40,6 +40,9 @@
 #include "warn.hh"
 #include "lily-imports.hh"
 
+using std::set;
+using std::string;
+using std::vector;
 
 Grob *
 Grob::clone () const
diff --git a/lily/guile-init.cc b/lily/guile-init.cc
index 4270aa01d6..dda1baaaa2 100644
--- a/lily/guile-init.cc
+++ b/lily/guile-init.cc
@@ -24,6 +24,8 @@
 #include "smobs.hh"
 #include "lily-imports.hh"
 
+using std::vector;
+
 /*
   INIT
 */
diff --git a/lily/hara-kiri-group-spanner.cc b/lily/hara-kiri-group-spanner.cc
index 06410786a6..a4389a5818 100644
--- a/lily/hara-kiri-group-spanner.cc
+++ b/lily/hara-kiri-group-spanner.cc
@@ -26,6 +26,8 @@
 #include "spanner.hh"
 #include "warn.hh"
 
+using std::vector;
+
 MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, y_extent, 1);
 SCM
 Hara_kiri_group_spanner::y_extent (SCM smob)
diff --git a/lily/horizontal-bracket-engraver.cc b/lily/horizontal-bracket-engraver.cc
index cd46817904..7f14a7ee9b 100644
--- a/lily/horizontal-bracket-engraver.cc
+++ b/lily/horizontal-bracket-engraver.cc
@@ -28,6 +28,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Horizontal_bracket_engraver : public Engraver
 {
 public:
diff --git a/lily/horizontal-bracket.cc b/lily/horizontal-bracket.cc
index ddeec44d75..000da711fe 100644
--- a/lily/horizontal-bracket.cc
+++ b/lily/horizontal-bracket.cc
@@ -30,6 +30,8 @@
 #include "spanner.hh"
 #include "item.hh"
 
+using std::vector;
+
 Stencil
 Horizontal_bracket::make_bracket (Grob *me,
                                   Real length,
diff --git a/lily/includable-lexer.cc b/lily/includable-lexer.cc
index 8567ec9171..564b6024cd 100644
--- a/lily/includable-lexer.cc
+++ b/lily/includable-lexer.cc
@@ -32,6 +32,8 @@ using namespace std;
 #include "sources.hh"
 #include "warn.hh"
 
+using std::string;
+
 #ifndef YY_BUF_SIZE
 #define YY_BUF_SIZE 16384
 #endif
diff --git a/lily/input-scheme.cc b/lily/input-scheme.cc
index 42d35816c3..1eeccf4f64 100644
--- a/lily/input-scheme.cc
+++ b/lily/input-scheme.cc
@@ -20,6 +20,8 @@
 #include "std-string.hh"
 #include "input.hh"
 
+using std::string;
+
 LY_DEFINE (ly_input_warning, "ly:input-warning", 2, 0, 1, (SCM sip, SCM msg, SCM rest),
            "Print @var{msg} as a GNU compliant warning message, pointing"
            " to the location in @var{sip}.  @var{msg} is interpreted"
diff --git a/lily/input-smob.cc b/lily/input-smob.cc
index f9de264277..4a8f01648d 100644
--- a/lily/input-smob.cc
+++ b/lily/input-smob.cc
@@ -21,6 +21,7 @@
 #include "source-file.hh"
 #include "std-string.hh"
 
+using std::string;
 
 /* Dummy input location for use if real one is missing.  */
 Input dummy_input_global;
diff --git a/lily/input.cc b/lily/input.cc
index b6aed9e2d1..74b7a61b32 100644
--- a/lily/input.cc
+++ b/lily/input.cc
@@ -29,6 +29,8 @@ using namespace std;
 #include "sources.hh"
 #include "warn.hh"
 
+using std::string;
+
 Input::Input (Input const &i)
 {
   source_file_ = i.source_file_;
diff --git a/lily/instrument-name-engraver.cc b/lily/instrument-name-engraver.cc
index d339fbce61..6c6b8f5f4e 100644
--- a/lily/instrument-name-engraver.cc
+++ b/lily/instrument-name-engraver.cc
@@ -28,6 +28,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Instrument_name_engraver : public Engraver
 {
 public:
diff --git a/lily/keep-alive-together-engraver.cc b/lily/keep-alive-together-engraver.cc
index 79fedc96df..b53b91eca4 100644
--- a/lily/keep-alive-together-engraver.cc
+++ b/lily/keep-alive-together-engraver.cc
@@ -25,6 +25,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Keep_alive_together_engraver: public Engraver
 {
   vector<Grob *> group_spanners_;
diff --git a/lily/key-signature-interface.cc b/lily/key-signature-interface.cc
index 3249a736c3..06b4c5e89e 100644
--- a/lily/key-signature-interface.cc
+++ b/lily/key-signature-interface.cc
@@ -29,6 +29,8 @@
 #include "rational.hh"
 #include "lily-imports.hh"
 
+using std::string;
+
 struct Key_signature_interface
 {
   DECLARE_SCHEME_CALLBACK (print, (SCM));
diff --git a/lily/kievan-ligature-engraver.cc b/lily/kievan-ligature-engraver.cc
index 25582c6a39..0439640c2f 100644
--- a/lily/kievan-ligature-engraver.cc
+++ b/lily/kievan-ligature-engraver.cc
@@ -29,6 +29,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Kievan_ligature_engraver : public Coherent_ligature_engraver
 {
 
diff --git a/lily/laissez-vibrer-engraver.cc b/lily/laissez-vibrer-engraver.cc
index 6e57a7e9df..d287d4800a 100644
--- a/lily/laissez-vibrer-engraver.cc
+++ b/lily/laissez-vibrer-engraver.cc
@@ -25,6 +25,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Laissez_vibrer_engraver : public Engraver
 {
   Stream_event *event_;
diff --git a/lily/least-squares.cc b/lily/least-squares.cc
index 9c250bea91..1056af060c 100644
--- a/lily/least-squares.cc
+++ b/lily/least-squares.cc
@@ -21,6 +21,8 @@
 
 #include "warn.hh"
 
+using std::vector;
+
 void
 minimise_least_squares (Real *coef, Real *offset,
                         vector<Offset> const &input)
diff --git a/lily/ledger-line-engraver.cc b/lily/ledger-line-engraver.cc
index 8e871c1abf..5209bce258 100644
--- a/lily/ledger-line-engraver.cc
+++ b/lily/ledger-line-engraver.cc
@@ -24,6 +24,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Ledger_line_engraver : public Engraver
 {
   Spanner *span_;
diff --git a/lily/ledger-line-spanner.cc b/lily/ledger-line-spanner.cc
index b0e8fee3c2..7463f676e9 100644
--- a/lily/ledger-line-spanner.cc
+++ b/lily/ledger-line-spanner.cc
@@ -28,6 +28,9 @@ using namespace std;
 #include "pointer-group-interface.hh"
 #include "paper-column.hh"
 
+using std::map;
+using std::vector;
+
 struct Ledger_line_spanner
 {
   DECLARE_SCHEME_CALLBACK (print, (SCM));
diff --git a/lily/lexer.ll b/lily/lexer.ll
index bfd2449e6b..870c466d16 100644
--- a/lily/lexer.ll
+++ b/lily/lexer.ll
@@ -73,6 +73,8 @@ using namespace std;
 #include "warn.hh"
 #include "lily-imports.hh"
 
+using std::string;
+
 /*
 RH 7 fix (?)
 */
diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc
index bde39214b3..5a54e864dd 100644
--- a/lily/lily-guile.cc
+++ b/lily/lily-guile.cc
@@ -42,6 +42,9 @@ using namespace std;
 #include "warn.hh"
 #include "lily-imports.hh"
 
+using std::string;
+using std::vector;
+
 /*
   symbols/strings.
  */
diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc
index b6cbda7f97..c58885a895 100644
--- a/lily/lily-lexer.cc
+++ b/lily/lily-lexer.cc
@@ -37,6 +37,8 @@ using namespace std;
 #include "lily-parser.hh"
 #include "ly-module.hh"
 
+using std::string;
+
 static Keyword_ent the_key_tab[]
 =
 {
diff --git a/lily/lily-parser-scheme.cc b/lily/lily-parser-scheme.cc
index ea84aae41a..8643248d5f 100644
--- a/lily/lily-parser-scheme.cc
+++ b/lily/lily-parser-scheme.cc
@@ -32,6 +32,8 @@
 #include "warn.hh"
 #include "lily-imports.hh"
 
+using std::string;
+
 LY_DEFINE (ly_parse_file, "ly:parse-file",
            1, 0, 0, (SCM name),
            "Parse a single @code{.ly} file."
diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc
index 3188974284..0893045193 100644
--- a/lily/lily-parser.cc
+++ b/lily/lily-parser.cc
@@ -37,6 +37,7 @@
 #include "warn.hh"
 #include "program-option.hh"
 
+using std::string;
 
 Lily_parser::Lily_parser (Sources *sources)
 {
diff --git a/lily/lily-version.cc b/lily/lily-version.cc
index f84730450f..5e8e32c4fc 100644
--- a/lily/lily-version.cc
+++ b/lily/lily-version.cc
@@ -22,6 +22,8 @@
 #include "config.hh"
 #include "version.hh"
 
+using std::string;
+
 string
 version_string ()
 {
diff --git a/lily/lilypond-version.cc b/lily/lilypond-version.cc
index b3401854c2..da269606f8 100644
--- a/lily/lilypond-version.cc
+++ b/lily/lilypond-version.cc
@@ -23,6 +23,9 @@
 #include "string-convert.hh"
 #include "misc.hh"
 
+using std::string;
+using std::vector;
+
 Lilypond_version::Lilypond_version (int major, int minor, int patch)
 {
   major_ = major;
diff --git a/lily/line-interface.cc b/lily/line-interface.cc
index b90be8c04c..0aeec91540 100644
--- a/lily/line-interface.cc
+++ b/lily/line-interface.cc
@@ -25,6 +25,8 @@
 #include "output-def.hh"
 #include "staff-symbol-referencer.hh"
 
+using std::vector;
+
 Stencil
 Line_interface::make_arrow (Offset begin, Offset end,
                             Real thick,
diff --git a/lily/lookup.cc b/lily/lookup.cc
index bad54405eb..c88e37700f 100644
--- a/lily/lookup.cc
+++ b/lily/lookup.cc
@@ -34,6 +34,8 @@ using namespace std;
 #include "main.hh"
 #include "lily-guile.hh"
 
+using std::vector;
+
 Stencil
 Lookup::beam (Real slope, Real width, Real thick, Real blot)
 {
diff --git a/lily/lyric-combine-music-iterator.cc b/lily/lyric-combine-music-iterator.cc
index 336b167f2e..6e8c617ef4 100644
--- a/lily/lyric-combine-music-iterator.cc
+++ b/lily/lyric-combine-music-iterator.cc
@@ -26,6 +26,8 @@
 #include "music-iterator.hh"
 #include "music.hh"
 
+using std::string;
+
 /*
   This iterator is hairy.  It tracks both lyric and melody contexts,
   and has a complicated communication route, reading/writing
diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc
index cdee61517e..7c88ccc8c7 100644
--- a/lily/lyric-engraver.cc
+++ b/lily/lyric-engraver.cc
@@ -27,6 +27,8 @@
 
 #include "translator.icc"
 
+using std::string;
+
 /**
    Generate texts for lyric syllables.  We only do one lyric at a time.
    Multiple copies of this engraver should be used to do multiple voices.
diff --git a/lily/lyric-performer.cc b/lily/lyric-performer.cc
index 0ad69ae053..8d76a6e107 100644
--- a/lily/lyric-performer.cc
+++ b/lily/lyric-performer.cc
@@ -22,6 +22,8 @@
 #include "stream-event.hh"
 #include "translator.icc"
 
+using std::vector;
+
 class Lyric_performer : public Performer
 {
 public:
diff --git a/lily/main.cc b/lily/main.cc
index d84f90ebd8..001dc3a882 100644
--- a/lily/main.cc
+++ b/lily/main.cc
@@ -130,7 +130,7 @@ static char const *WARRANTY
 //string lilypond_datadir; // moved to global-data.cc
 
 /* The jail specification: USER, GROUP, JAIL, DIR. */
-string jail_spec;
+std::string jail_spec;
 
 /*  The option parser */
 static Getopt_long *option_parser = 0;
@@ -214,6 +214,10 @@ configure_fpu ()
 
 #endif /* defined(__x86__) || defined(__i386__) */
 
+using std::map;
+using std::string;
+using std::vector;
+
 static void
 env_var_info (FILE *out, char const *key)
 /*
diff --git a/lily/melody-spanner.cc b/lily/melody-spanner.cc
index 3550e89382..a1cddf04d8 100644
--- a/lily/melody-spanner.cc
+++ b/lily/melody-spanner.cc
@@ -22,6 +22,8 @@
 #include "grob.hh"
 #include "pointer-group-interface.hh"
 
+using std::vector;
+
 /*
   TODO: this could be either item or spanner. For efficiency reasons,
   let's take item for now.
diff --git a/lily/mensural-ligature-engraver.cc b/lily/mensural-ligature-engraver.cc
index ac1eb1f10a..b4954c24de 100644
--- a/lily/mensural-ligature-engraver.cc
+++ b/lily/mensural-ligature-engraver.cc
@@ -35,6 +35,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 /*
  * TODO: accidentals are aligned with the first note;
  * they must appear ahead.
diff --git a/lily/mensural-ligature.cc b/lily/mensural-ligature.cc
index 5a3b3e9543..3d605ec5eb 100644
--- a/lily/mensural-ligature.cc
+++ b/lily/mensural-ligature.cc
@@ -30,6 +30,8 @@
 #include "staff-symbol-referencer.hh"
 #include "warn.hh"
 
+using std::string;
+
 /*
   draws one half a flexa, i.e. a portion corresponding to a single note.
   this way coloration of the two notes building up the flexa can be
diff --git a/lily/midi-chunk.cc b/lily/midi-chunk.cc
index aed9e2b7dd..48543b10db 100644
--- a/lily/midi-chunk.cc
+++ b/lily/midi-chunk.cc
@@ -24,6 +24,9 @@
 #include "std-string.hh"
 #include "string-convert.hh"
 
+using std::string;
+using std::vector;
+
 Midi_track::Midi_track (int number, bool port)
   : number_ (number)
 {
diff --git a/lily/midi-control-function-performer.cc b/lily/midi-control-function-performer.cc
index 90ea063f73..1305b9378e 100644
--- a/lily/midi-control-function-performer.cc
+++ b/lily/midi-control-function-performer.cc
@@ -31,6 +31,8 @@
 
 #include "translator.icc"
 
+using std::string;
+
 /**
    MIDI control function performer.  Announces "set property" events on MIDI
    context properties.
diff --git a/lily/midi-item.cc b/lily/midi-item.cc
index 33dd9f11bd..a602edc6fe 100644
--- a/lily/midi-item.cc
+++ b/lily/midi-item.cc
@@ -30,6 +30,8 @@
 #include "warn.hh"
 #include "lily-imports.hh"
 
+using std::string;
+
 #define PITCH_WHEEL_CENTER 0x2000
 #define PITCH_WHEEL_SEMITONE 0X1000
 
diff --git a/lily/midi-stream.cc b/lily/midi-stream.cc
index d0f8531094..801919fa8b 100644
--- a/lily/midi-stream.cc
+++ b/lily/midi-stream.cc
@@ -30,6 +30,8 @@ using namespace std;
 #include "string-convert.hh"
 #include "warn.hh"
 
+using std::string;
+
 Midi_stream::Midi_stream (const string &file_name)
 {
   file_name_string_ = file_name;
diff --git a/lily/misc.cc b/lily/misc.cc
index b930fd521a..7bb417bd62 100644
--- a/lily/misc.cc
+++ b/lily/misc.cc
@@ -22,6 +22,9 @@
 #include "offset.hh"
 #include "warn.hh"
 
+using std::string;
+using std::vector;
+
 /*
   Return the 2-log, rounded down
 */
diff --git a/lily/modified-font-metric.cc b/lily/modified-font-metric.cc
index d1c80b66f0..2256eb9d18 100644
--- a/lily/modified-font-metric.cc
+++ b/lily/modified-font-metric.cc
@@ -26,6 +26,8 @@ using namespace std;
 #include "main.hh"
 #include "program-option.hh"
 
+using std::string;
+
 Modified_font_metric::Modified_font_metric (Font_metric *fm,
                                             Real magnification)
 {
diff --git a/lily/moment.cc b/lily/moment.cc
index 81ab30e3ae..e654eb3536 100644
--- a/lily/moment.cc
+++ b/lily/moment.cc
@@ -21,6 +21,8 @@
 
 #include "warn.hh"
 
+using std::string;
+
 Moment::Moment ()
 {
 }
diff --git a/lily/multi-measure-rest-engraver.cc b/lily/multi-measure-rest-engraver.cc
index 274746b845..257711a7da 100644
--- a/lily/multi-measure-rest-engraver.cc
+++ b/lily/multi-measure-rest-engraver.cc
@@ -29,6 +29,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 /**
    The name says it all: make multi measure rests
 */
diff --git a/lily/new-fingering-engraver.cc b/lily/new-fingering-engraver.cc
index 3ecad3a89e..e0b0d09809 100644
--- a/lily/new-fingering-engraver.cc
+++ b/lily/new-fingering-engraver.cc
@@ -31,6 +31,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 struct Finger_tuple
 {
   Grob *head_;
diff --git a/lily/note-collision.cc b/lily/note-collision.cc
index f98cb5a3a0..4d1303b739 100644
--- a/lily/note-collision.cc
+++ b/lily/note-collision.cc
@@ -33,6 +33,8 @@
 #include "stem.hh"
 #include "warn.hh"
 
+using std::vector;
+
 Real
 check_meshing_chords (Grob *me,
                       Grob *clash_up, Grob *clash_down)
diff --git a/lily/note-head.cc b/lily/note-head.cc
index 33bbf339ca..dda8e040b9 100644
--- a/lily/note-head.cc
+++ b/lily/note-head.cc
@@ -33,6 +33,8 @@ using namespace std;
 #include "staff-symbol-referencer.hh"
 #include "warn.hh"
 
+using std::string;
+
 static Stencil
 internal_print (Grob *me, string *font_char)
 {
diff --git a/lily/note-heads-engraver.cc b/lily/note-heads-engraver.cc
index 6322dfa2b9..20036d021f 100644
--- a/lily/note-heads-engraver.cc
+++ b/lily/note-heads-engraver.cc
@@ -33,6 +33,8 @@ using namespace std;
 
 #include "translator.icc"
 
+using std::vector;
+
 class Note_heads_engraver : public Engraver
 {
   vector<Stream_event *> note_evs_;
diff --git a/lily/note-name-engraver.cc b/lily/note-name-engraver.cc
index 3ae9840e0d..764d82b85e 100644
--- a/lily/note-name-engraver.cc
+++ b/lily/note-name-engraver.cc
@@ -24,6 +24,9 @@
 
 #include "translator.icc"
 
+using std::string;
+using std::vector;
+
 class Note_name_engraver : public Engraver
 {
 public:
diff --git a/lily/note-performer.cc b/lily/note-performer.cc
index aa46440006..31ecfa268f 100644
--- a/lily/note-performer.cc
+++ b/lily/note-performer.cc
@@ -26,6 +26,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Note_performer : public Performer
 {
 public:
diff --git a/lily/note-spacing-engraver.cc b/lily/note-spacing-engraver.cc
index f0bca862d9..1838b0e4b3 100644
--- a/lily/note-spacing-engraver.cc
+++ b/lily/note-spacing-engraver.cc
@@ -28,6 +28,8 @@
 
 #include "translator.icc"
 
+using std::map;
+
 class Note_spacing_engraver : public Engraver
 {
   typedef map <Context *, Grob *> Last_spacing_map;
diff --git a/lily/note-spacing.cc b/lily/note-spacing.cc
index a894be2539..eab3651520 100644
--- a/lily/note-spacing.cc
+++ b/lily/note-spacing.cc
@@ -35,6 +35,8 @@
 #include "stem.hh"
 #include "warn.hh"
 
+using std::vector;
+
 /*
   Adjust the ideal and minimum distance between note columns,
   based on the notehead size, skylines, and optical illusions.
diff --git a/lily/one-line-page-breaking.cc b/lily/one-line-page-breaking.cc
index 213864462f..9110cdad96 100644
--- a/lily/one-line-page-breaking.cc
+++ b/lily/one-line-page-breaking.cc
@@ -30,6 +30,8 @@
 #include "simple-spacer.hh"
 #include "system.hh"
 
+using std::vector;
+
 One_line_page_breaking::One_line_page_breaking (Paper_book *pb)
   : Page_breaking (pb, 0, 0)
 {
diff --git a/lily/open-type-font-scheme.cc b/lily/open-type-font-scheme.cc
index 79370fa698..8d5f066e98 100644
--- a/lily/open-type-font-scheme.cc
+++ b/lily/open-type-font-scheme.cc
@@ -20,6 +20,8 @@
 #include "modified-font-metric.hh"
 #include "open-type-font.hh"
 
+using std::string;
+
 LY_DEFINE (ly_font_sub_fonts, "ly:font-sub-fonts", 1, 0, 0,
            (SCM font),
            "Given the font metric @var{font} of an OpenType font, return the"
diff --git a/lily/open-type-font.cc b/lily/open-type-font.cc
index 3038df4331..8a7bdf7221 100644
--- a/lily/open-type-font.cc
+++ b/lily/open-type-font.cc
@@ -31,6 +31,9 @@ using namespace std;
 #include "modified-font-metric.hh"
 #include "warn.hh"
 
+using std::map;
+using std::string;
+
 FT_Byte *
 load_table (char const *tag_str, FT_Face face, FT_ULong *length)
 {
diff --git a/lily/output-def.cc b/lily/output-def.cc
index e277a00534..aba0f5e55e 100644
--- a/lily/output-def.cc
+++ b/lily/output-def.cc
@@ -33,6 +33,8 @@
 
 #include "string-convert.hh"
 
+using std::string;
+
 Output_def::Output_def ()
 {
   scope_ = SCM_EOL;
diff --git a/lily/output-property-engraver.cc b/lily/output-property-engraver.cc
index c14a6ee563..2150a20882 100644
--- a/lily/output-property-engraver.cc
+++ b/lily/output-property-engraver.cc
@@ -24,6 +24,7 @@
 
 #include "translator.icc"
 
+using std::vector;
 
 class Output_property_engraver : public Engraver
 {
diff --git a/lily/page-breaking.cc b/lily/page-breaking.cc
index ef9e095d6a..20ae15271a 100644
--- a/lily/page-breaking.cc
+++ b/lily/page-breaking.cc
@@ -142,6 +142,9 @@
 #include "system.hh"
 #include "warn.hh"
 
+using std::pair;
+using std::vector;
+
 /* for each forbidden page break, merge the systems around it into one
    system. */
 static vector<Line_details>
diff --git a/lily/page-layout-problem.cc b/lily/page-layout-problem.cc
index 8f1951223c..b0ef9ab36d 100644
--- a/lily/page-layout-problem.cc
+++ b/lily/page-layout-problem.cc
@@ -35,6 +35,8 @@
 #include "text-interface.hh"
 #include "lily-imports.hh"
 
+using std::vector;
+
 /*
  Returns the number of footnotes associated with a given line.
 */
diff --git a/lily/page-spacing.cc b/lily/page-spacing.cc
index 97c68a5e29..ce9aabedac 100644
--- a/lily/page-spacing.cc
+++ b/lily/page-spacing.cc
@@ -24,6 +24,8 @@
 #include "page-breaking.hh"
 #include "warn.hh"
 
+using std::vector;
+
 void
 Page_spacing::calc_force ()
 {
diff --git a/lily/page-turn-engraver.cc b/lily/page-turn-engraver.cc
index dd90ba71cf..82b33aadfb 100644
--- a/lily/page-turn-engraver.cc
+++ b/lily/page-turn-engraver.cc
@@ -29,6 +29,9 @@
 
 #include "translator.icc"
 
+using std::string;
+using std::vector;
+
 class Page_turn_event
 {
 public:
diff --git a/lily/page-turn-page-breaking.cc b/lily/page-turn-page-breaking.cc
index 09545020c4..85a090f6ea 100644
--- a/lily/page-turn-page-breaking.cc
+++ b/lily/page-turn-page-breaking.cc
@@ -29,6 +29,9 @@
 #include "system.hh"
 #include "warn.hh"
 
+using std::string;
+using std::vector;
+
 template<typename T>
 static bool
 is_break (T *g)
diff --git a/lily/pango-font.cc b/lily/pango-font.cc
index 9e3a2d38b3..a1e6182c56 100644
--- a/lily/pango-font.cc
+++ b/lily/pango-font.cc
@@ -45,6 +45,8 @@
 #if HAVE_PANGO_FT2
 #include "stencil.hh"
 
+using std::string;
+
 Pango_font::Pango_font (PangoFT2FontMap *fontmap,
                         PangoFontDescription const *description,
                         Real output_scale)
diff --git a/lily/pango-select.cc b/lily/pango-select.cc
index 8091e466ee..2c1d92c5a8 100644
--- a/lily/pango-select.cc
+++ b/lily/pango-select.cc
@@ -23,6 +23,8 @@
 #include "output-def.hh"
 #include "pango-font.hh"
 
+using std::string;
+
 PangoFontDescription *
 properties_to_pango_description (SCM chain, Real text_size)
 {
diff --git a/lily/paper-book.cc b/lily/paper-book.cc
index e23ef52777..fad78957fd 100644
--- a/lily/paper-book.cc
+++ b/lily/paper-book.cc
@@ -33,6 +33,8 @@
 #include "ly-module.hh"
 #include "lily-imports.hh"
 
+using std::string;
+using std::vector;
 
 Paper_book::Paper_book ()
 {
diff --git a/lily/paper-column-engraver.cc b/lily/paper-column-engraver.cc
index 7c44f173d7..68095c2d6e 100644
--- a/lily/paper-column-engraver.cc
+++ b/lily/paper-column-engraver.cc
@@ -34,6 +34,8 @@
 
 #include "translator.icc"
 
+using std::string;
+
 Paper_column_engraver::Paper_column_engraver ()
 {
   last_moment_.main_part_ = Rational (-1, 1);
diff --git a/lily/paper-column.cc b/lily/paper-column.cc
index da3807c31d..6fbefdd6cb 100644
--- a/lily/paper-column.cc
+++ b/lily/paper-column.cc
@@ -39,6 +39,9 @@
 #include "text-interface.hh"
 #include "warn.hh"
 
+using std::string;
+using std::vector;
+
 Grob *
 Paper_column::clone () const
 {
diff --git a/lily/paper-outputter-scheme.cc b/lily/paper-outputter-scheme.cc
index 145e9bfa93..bedd02f8ca 100644
--- a/lily/paper-outputter-scheme.cc
+++ b/lily/paper-outputter-scheme.cc
@@ -23,6 +23,8 @@
 #include "stencil.hh"
 #include "warn.hh"
 
+using std::string;
+
 LY_DEFINE (ly_make_paper_outputter, "ly:make-paper-outputter",
            2, 0, 0, (SCM port, SCM format),
            "Create an outputter that evaluates within"
diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc
index a72ea59ccd..87f14570e2 100644
--- a/lily/paper-outputter.cc
+++ b/lily/paper-outputter.cc
@@ -39,6 +39,7 @@ using namespace std;
 #include "warn.hh"
 #include "lily-imports.hh"
 
+using std::string;
 
 Paper_outputter::Paper_outputter (SCM port, const string &format)
 {
diff --git a/lily/paper-score.cc b/lily/paper-score.cc
index 0cecb79511..3e9169c3da 100644
--- a/lily/paper-score.cc
+++ b/lily/paper-score.cc
@@ -34,6 +34,8 @@
 #include "warn.hh"
 #include "constrained-breaking.hh"
 
+using std::vector;
+
 Paper_score::Paper_score (Output_def *layout)
 {
   layout_ = layout;
diff --git a/lily/parser.yy b/lily/parser.yy
index 87edcdafed..cadcd89869 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -141,7 +141,7 @@ using namespace std;
 #include "lily-imports.hh"
 
 void
-Lily_parser::parser_error (Input const *i, Lily_parser *parser, SCM *, const string &s)
+Lily_parser::parser_error (Input const *i, Lily_parser *parser, SCM *, const std::string &s)
 {
 	parser->parser_error (*i, s);
 }
@@ -223,6 +223,7 @@ SCM get_next_unique_lyrics_context_id ();
 #define _(x) gettext (x)
 #endif
 
+using std::string;
 
 static Music *make_music_with_input (SCM name, Input where);
 SCM check_scheme_arg (Lily_parser *parser, Input loc,
diff --git a/lily/part-combine-part-iterator.cc b/lily/part-combine-part-iterator.cc
index b9262d92fd..e7c92d55e2 100644
--- a/lily/part-combine-part-iterator.cc
+++ b/lily/part-combine-part-iterator.cc
@@ -20,6 +20,8 @@
 #include "change-sequence-iterator.hh"
 #include "context.hh"
 
+using std::string;
+
 class Part_combine_part_iterator : public Change_sequence_iterator
 {
 public:
diff --git a/lily/percent-repeat-iterator.cc b/lily/percent-repeat-iterator.cc
index 00d8eed88b..1412f44de2 100644
--- a/lily/percent-repeat-iterator.cc
+++ b/lily/percent-repeat-iterator.cc
@@ -24,6 +24,8 @@
 #include "sequential-iterator.hh"
 #include "lily-imports.hh"
 
+using std::string;
+
 class Percent_repeat_iterator : public Sequential_iterator
 {
 public:
diff --git a/lily/performance.cc b/lily/performance.cc
index 9f840efd25..3024ea69af 100644
--- a/lily/performance.cc
+++ b/lily/performance.cc
@@ -35,6 +35,8 @@ using namespace std;
 #include "string-convert.hh"
 #include "warn.hh"
 
+using std::string;
+
 Performance::Performance (bool ports)
   : midi_ (0),
     ports_ (ports),
diff --git a/lily/pfb-scheme.cc b/lily/pfb-scheme.cc
index 4a13515472..ee26c9ec5a 100644
--- a/lily/pfb-scheme.cc
+++ b/lily/pfb-scheme.cc
@@ -6,6 +6,9 @@
 #include "main.hh"
 #include "warn.hh"
 
+using std::string;
+using std::vector;
+
 LY_DEFINE (ly_pfb_2_pfa, "ly:pfb->pfa",
            1, 0, 0, (SCM pfb_file_name),
            "Convert the contents of a Type@tie{}1 font in PFB format"
diff --git a/lily/piano-pedal-align-engraver.cc b/lily/piano-pedal-align-engraver.cc
index 7134a6cfc7..1377cffdce 100644
--- a/lily/piano-pedal-align-engraver.cc
+++ b/lily/piano-pedal-align-engraver.cc
@@ -29,6 +29,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 /*
   TODO:
 
diff --git a/lily/piano-pedal-engraver.cc b/lily/piano-pedal-engraver.cc
index 2fb99407d5..b94a51cc62 100644
--- a/lily/piano-pedal-engraver.cc
+++ b/lily/piano-pedal-engraver.cc
@@ -41,6 +41,8 @@
 
 #include <string.h>
 
+using std::string;
+
 /*
   TODO:
 
diff --git a/lily/piano-pedal-performer.cc b/lily/piano-pedal-performer.cc
index 49ec0dd7fe..e7df2c233a 100644
--- a/lily/piano-pedal-performer.cc
+++ b/lily/piano-pedal-performer.cc
@@ -26,6 +26,9 @@
 
 #include "translator.icc"
 
+using std::string;
+using std::vector;
+
 enum Pedal_type {SOSTENUTO, SUSTAIN, UNA_CORDA, NUM_PEDAL_TYPES};
 
 /**
diff --git a/lily/pitch.cc b/lily/pitch.cc
index e34562fecc..610e30480f 100644
--- a/lily/pitch.cc
+++ b/lily/pitch.cc
@@ -26,6 +26,8 @@
 
 #include <cmath>
 
+using std::string;
+
 Pitch::Pitch (int o, int n, Rational a)
 {
   notename_ = n;
diff --git a/lily/pitched-trill-engraver.cc b/lily/pitched-trill-engraver.cc
index 30d734346e..b9e2285eb9 100644
--- a/lily/pitched-trill-engraver.cc
+++ b/lily/pitched-trill-engraver.cc
@@ -32,6 +32,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Pitched_trill_engraver : public Engraver
 {
 public:
diff --git a/lily/pointer-group-interface.cc b/lily/pointer-group-interface.cc
index 2720fcf91a..f404e24b63 100644
--- a/lily/pointer-group-interface.cc
+++ b/lily/pointer-group-interface.cc
@@ -22,6 +22,8 @@
 #include "grob-array.hh"
 #include "grob.hh"
 
+using std::vector;
+
 int
 Pointer_group_interface::count (Grob *me, SCM sym)
 {
diff --git a/lily/prob.cc b/lily/prob.cc
index 938f106861..6e2a8addd7 100644
--- a/lily/prob.cc
+++ b/lily/prob.cc
@@ -23,6 +23,7 @@
 #include "input.hh"
 #include "profile.hh"
 
+using std::string;
 
 const char Prob::type_p_name_[] = "ly:prob?";
 
diff --git a/lily/program-option-scheme.cc b/lily/program-option-scheme.cc
index 3934217fb3..b7003c085c 100644
--- a/lily/program-option-scheme.cc
+++ b/lily/program-option-scheme.cc
@@ -31,6 +31,9 @@ using namespace std;
 #include "warn.hh"
 #include "lily-imports.hh"
 
+using std::string;
+using std::vector;
+
 bool debug_skylines;
 bool debug_property_callbacks;
 bool debug_page_breaking_scoring;
diff --git a/lily/program-option.cc b/lily/program-option.cc
index 21fc5c166c..00745cba27 100644
--- a/lily/program-option.cc
+++ b/lily/program-option.cc
@@ -20,6 +20,8 @@
 
 #include "program-option.hh"
 
+using std::string;
+
 string
 get_output_backend_name ()
 {
diff --git a/lily/pure-from-neighbor-engraver.cc b/lily/pure-from-neighbor-engraver.cc
index e147f53cca..387c1cd013 100644
--- a/lily/pure-from-neighbor-engraver.cc
+++ b/lily/pure-from-neighbor-engraver.cc
@@ -28,6 +28,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Pure_from_neighbor_engraver : public Engraver
 {
   vector<Grob *> pure_relevants_;
diff --git a/lily/pure-from-neighbor-interface.cc b/lily/pure-from-neighbor-interface.cc
index 745c23dbec..23974adc1e 100644
--- a/lily/pure-from-neighbor-interface.cc
+++ b/lily/pure-from-neighbor-interface.cc
@@ -27,6 +27,8 @@
 #include "spanner.hh"
 #include "system.hh"
 
+using std::vector;
+
 MAKE_SCHEME_CALLBACK (Pure_from_neighbor_interface, calc_pure_relevant_grobs, 1);
 SCM
 Pure_from_neighbor_interface::calc_pure_relevant_grobs (SCM smob)
diff --git a/lily/relative-octave-check.cc b/lily/relative-octave-check.cc
index 12abf81254..ba27fab768 100644
--- a/lily/relative-octave-check.cc
+++ b/lily/relative-octave-check.cc
@@ -21,6 +21,8 @@
 #include "international.hh"
 #include "music.hh"
 
+using std::string;
+
 class Relative_octave_check
 {
 public:
diff --git a/lily/relocate.cc b/lily/relocate.cc
index 879377a1cc..957fb7bf34 100644
--- a/lily/relocate.cc
+++ b/lily/relocate.cc
@@ -43,6 +43,9 @@
 #include <winbase.h>
 #endif
 
+using std::string;
+using std::vector;
+
 #define FRAMEWORKDIR ".."
 
 int
diff --git a/lily/repeat-acknowledge-engraver.cc b/lily/repeat-acknowledge-engraver.cc
index 67477b1f01..96ed3039b5 100644
--- a/lily/repeat-acknowledge-engraver.cc
+++ b/lily/repeat-acknowledge-engraver.cc
@@ -24,6 +24,8 @@
 
 #include "translator.icc"
 
+using std::string;
+
 /*
   Objective:
 
diff --git a/lily/repeat-tie-engraver.cc b/lily/repeat-tie-engraver.cc
index 4eea8e5800..757617ee23 100644
--- a/lily/repeat-tie-engraver.cc
+++ b/lily/repeat-tie-engraver.cc
@@ -25,6 +25,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Repeat_tie_engraver : public Engraver
 {
   Stream_event *event_;
diff --git a/lily/rest-collision-engraver.cc b/lily/rest-collision-engraver.cc
index a70641cfd0..6406d1318f 100644
--- a/lily/rest-collision-engraver.cc
+++ b/lily/rest-collision-engraver.cc
@@ -34,6 +34,8 @@
 
 #include "translator.icc"
 
+using std::set;
+
 class Rest_collision_engraver : public Engraver
 {
 protected:
diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc
index 536ced40e5..8425e6eee2 100644
--- a/lily/rest-collision.cc
+++ b/lily/rest-collision.cc
@@ -38,6 +38,8 @@ using namespace std;
 #include "warn.hh"
 #include "lily-imports.hh"
 
+using std::vector;
+
 MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Rest_collision, force_shift_callback_rest, 2, 1, "");
 SCM
 Rest_collision::force_shift_callback_rest (SCM rest, SCM offset)
diff --git a/lily/rest.cc b/lily/rest.cc
index f562f69534..bfaf5d8bde 100644
--- a/lily/rest.cc
+++ b/lily/rest.cc
@@ -30,6 +30,8 @@
 #include "stencil.hh"
 #include "grob.hh"
 
+using std::string;
+
 // -> offset callback
 MAKE_SCHEME_CALLBACK (Rest, y_offset_callback, 1);
 SCM
diff --git a/lily/rhythmic-column-engraver.cc b/lily/rhythmic-column-engraver.cc
index 28a06f79b0..34527af57a 100644
--- a/lily/rhythmic-column-engraver.cc
+++ b/lily/rhythmic-column-engraver.cc
@@ -27,6 +27,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 /*
   this engraver  glues together stems, rests and note heads into a NoteColumn
   grob.
diff --git a/lily/scale.cc b/lily/scale.cc
index 02c1dc5f8e..220110b8b2 100644
--- a/lily/scale.cc
+++ b/lily/scale.cc
@@ -22,6 +22,7 @@
 #include "scale.hh"
 #include "protected-scm.hh"
 
+using std::vector;
 
 /*
   todo: put string <-> pitch here too.
diff --git a/lily/script-column-engraver.cc b/lily/script-column-engraver.cc
index dc34098664..14546ab512 100644
--- a/lily/script-column-engraver.cc
+++ b/lily/script-column-engraver.cc
@@ -24,6 +24,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 /**
    Find potentially colliding scripts, and put them in a
    Script_column, that will fix the collisions.  */
diff --git a/lily/script-column.cc b/lily/script-column.cc
index 94aa8908e7..dbe638fcf9 100644
--- a/lily/script-column.cc
+++ b/lily/script-column.cc
@@ -29,6 +29,9 @@
 
 #include <map>
 
+using std::map;
+using std::vector;
+
 typedef map<Grob *, vector <Grob *> > Grob_scripts_map;
 
 void
diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc
index 62c3de482c..74c5285c17 100644
--- a/lily/script-engraver.cc
+++ b/lily/script-engraver.cc
@@ -35,6 +35,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 struct Script_tuple
 {
   Stream_event *event_;
diff --git a/lily/script-row-engraver.cc b/lily/script-row-engraver.cc
index 35b5038020..5476fec64c 100644
--- a/lily/script-row-engraver.cc
+++ b/lily/script-row-engraver.cc
@@ -27,6 +27,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 /**
    Find potentially colliding scripts, and put them in a
    Script_row
diff --git a/lily/semi-tie-column.cc b/lily/semi-tie-column.cc
index 202195d830..26daa56781 100644
--- a/lily/semi-tie-column.cc
+++ b/lily/semi-tie-column.cc
@@ -29,6 +29,8 @@
 #include "item.hh"
 #include "tie-formatting-problem.hh"
 
+using std::vector;
+
 ADD_INTERFACE (Semi_tie_column,
                "The interface for a column of l.v. (laissez vibrer) ties.",
 
diff --git a/lily/separating-line-group-engraver.cc b/lily/separating-line-group-engraver.cc
index 08069afda8..b734946504 100644
--- a/lily/separating-line-group-engraver.cc
+++ b/lily/separating-line-group-engraver.cc
@@ -32,6 +32,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 struct Spacings
 {
   Item *staff_spacing_;
diff --git a/lily/separation-item.cc b/lily/separation-item.cc
index e29b8a9129..632f6bcccf 100644
--- a/lily/separation-item.cc
+++ b/lily/separation-item.cc
@@ -30,6 +30,8 @@
 #include "stencil.hh"
 #include "warn.hh"
 
+using std::vector;
+
 void
 Separation_item::add_item (Grob *s, Item *i)
 {
diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc
index 16e2929a66..efb182092f 100644
--- a/lily/side-position-interface.cc
+++ b/lily/side-position-interface.cc
@@ -48,6 +48,10 @@ using namespace std;
 #include "warn.hh"
 #include "unpure-pure-container.hh"
 
+using std::set;
+using std::string;
+using std::vector;
+
 void
 Side_position_interface::add_support (Grob *me, Grob *e)
 {
diff --git a/lily/simple-spacer-scheme.cc b/lily/simple-spacer-scheme.cc
index 7c1c866c61..61a2d5dee4 100644
--- a/lily/simple-spacer-scheme.cc
+++ b/lily/simple-spacer-scheme.cc
@@ -24,6 +24,8 @@
 #include "warn.hh"
 #include "simple-spacer.hh"
 
+using std::vector;
+
 LY_DEFINE (ly_solve_spring_rod_problem, "ly:solve-spring-rod-problem",
            4, 1, 0, (SCM springs, SCM rods, SCM length, SCM ragged),
            "Solve a spring and rod problem for @var{count} objects, that"
diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc
index bf64413a8a..5b8183d96a 100644
--- a/lily/simple-spacer.cc
+++ b/lily/simple-spacer.cc
@@ -32,6 +32,8 @@
 #include "spring.hh"
 #include "warn.hh"
 
+using std::vector;
+
 /*
   A simple spacing constraint solver. The approach:
 
diff --git a/lily/skyline-pair.cc b/lily/skyline-pair.cc
index b3c2b96df4..67fef4c51a 100644
--- a/lily/skyline-pair.cc
+++ b/lily/skyline-pair.cc
@@ -22,6 +22,8 @@
 
 #include "international.hh"
 
+using std::vector;
+
 Skyline_pair::Skyline_pair ()
   : skylines_ (Skyline (DOWN), Skyline (UP))
 {
diff --git a/lily/skyline.cc b/lily/skyline.cc
index f46b2f3e84..5ce66cb999 100644
--- a/lily/skyline.cc
+++ b/lily/skyline.cc
@@ -22,6 +22,10 @@
 #include <deque>
 #include <cstdio>
 
+using std::deque;
+using std::list;
+using std::vector;
+
 /* A skyline is a sequence of non-overlapping buildings: something like
    this:
                    _______
diff --git a/lily/slur-configuration.cc b/lily/slur-configuration.cc
index dc453a9729..aac2a97a0e 100644
--- a/lily/slur-configuration.cc
+++ b/lily/slur-configuration.cc
@@ -31,6 +31,9 @@
 #include "tie.hh"
 #include "warn.hh"
 
+using std::string;
+using std::vector;
+
 Bezier
 avoid_staff_line (Slur_score_state const &state,
                   Bezier bez)
diff --git a/lily/slur-proto-engraver.cc b/lily/slur-proto-engraver.cc
index 215fcfd7a3..0885cb2b51 100644
--- a/lily/slur-proto-engraver.cc
+++ b/lily/slur-proto-engraver.cc
@@ -31,6 +31,8 @@
 
 #include "translator.icc"
 
+using std::string;
+
 void
 Slur_proto_engraver::derived_mark () const
 {
diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc
index edd45f6427..58ad4873d9 100644
--- a/lily/slur-scoring.cc
+++ b/lily/slur-scoring.cc
@@ -44,6 +44,9 @@
 #include "stem.hh"
 #include "warn.hh"
 
+using std::string;
+using std::vector;
+
 /*
   TODO:
 
diff --git a/lily/slur.cc b/lily/slur.cc
index 5f95e5d4d6..d3beb33625 100644
--- a/lily/slur.cc
+++ b/lily/slur.cc
@@ -43,6 +43,9 @@
 #include "unpure-pure-container.hh"
 #include "international.hh"
 
+using std::string;
+using std::vector;
+
 MAKE_SCHEME_CALLBACK (Slur, calc_direction, 1)
 SCM
 Slur::calc_direction (SCM smob)
diff --git a/lily/source-file.cc b/lily/source-file.cc
index 5a94927a7f..a3c08d29ba 100644
--- a/lily/source-file.cc
+++ b/lily/source-file.cc
@@ -33,7 +33,6 @@
 #include <sstream>
 #else
 #include <strstream>
-#define istringstream(x) istrstream (x, length ())
 #endif
 using namespace std;
 
@@ -42,6 +41,16 @@ using namespace std;
 #include "misc.hh"
 #include "warn.hh"
 
+#if HAVE_SSTREAM
+using std::istringstream;
+#else
+#define istringstream(x) std::istrstream (x, length ())
+#endif
+
+using std::istream;
+using std::string;
+using std::vector;
+
 void
 Source_file::load_stdin ()
 {
diff --git a/lily/sources.cc b/lily/sources.cc
index b42300f47a..9201010b12 100644
--- a/lily/sources.cc
+++ b/lily/sources.cc
@@ -24,6 +24,8 @@
 #include "file-name.hh"
 #include "file-path.hh"
 
+using std::string;
+
 Sources::Sources ()
 {
   path_ = 0;
diff --git a/lily/spacing-determine-loose-columns.cc b/lily/spacing-determine-loose-columns.cc
index 4be23042ad..12859cb191 100644
--- a/lily/spacing-determine-loose-columns.cc
+++ b/lily/spacing-determine-loose-columns.cc
@@ -32,6 +32,8 @@
 #include "break-align-interface.hh"
 #include "warn.hh"
 
+using std::vector;
+
 /*
   Return whether COL is fixed to its neighbors by some kind of spacing
   constraint.
diff --git a/lily/spacing-engraver.cc b/lily/spacing-engraver.cc
index cc5b1e31d1..244a55b376 100644
--- a/lily/spacing-engraver.cc
+++ b/lily/spacing-engraver.cc
@@ -29,6 +29,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 struct Rhythmic_tuple
 {
   Grob_info info_;
diff --git a/lily/spacing-interface.cc b/lily/spacing-interface.cc
index 030d02e727..bcad9d741c 100644
--- a/lily/spacing-interface.cc
+++ b/lily/spacing-interface.cc
@@ -30,6 +30,8 @@
 #include "skyline-pair.hh"
 #include "system.hh"
 
+using std::vector;
+
 /* return the right-pointing skyline of the left-items and the left-pointing
    skyline of the right-items (with the skyline of the left-items in
    ret[LEFT]) */
diff --git a/lily/spacing-loose-columns.cc b/lily/spacing-loose-columns.cc
index 15f77f34a0..462a793b06 100644
--- a/lily/spacing-loose-columns.cc
+++ b/lily/spacing-loose-columns.cc
@@ -28,6 +28,8 @@
 #include "moment.hh"
 #include "spacing-options.hh"
 
+using std::vector;
+
 /* Find the loose columns in POSNS, and drape them around the columns
    specified in BETWEEN-COLS.  */
 void
diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc
index cc353bc365..7ee6e3ef95 100644
--- a/lily/spacing-spanner.cc
+++ b/lily/spacing-spanner.cc
@@ -39,6 +39,8 @@
 #include "system.hh"
 #include "warn.hh"
 
+using std::vector;
+
 vector<Grob *>
 Spacing_spanner::get_columns (Grob *me_grob)
 {
diff --git a/lily/span-arpeggio-engraver.cc b/lily/span-arpeggio-engraver.cc
index f66c8770b5..209d6a03ed 100644
--- a/lily/span-arpeggio-engraver.cc
+++ b/lily/span-arpeggio-engraver.cc
@@ -29,6 +29,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 /**
    Make arpeggios that span multiple staves.  Catch arpeggios, and span a
    Span_arpeggio over them if we find more than two arpeggios.
diff --git a/lily/span-bar-engraver.cc b/lily/span-bar-engraver.cc
index 63c245e70c..eb0ff52f7f 100644
--- a/lily/span-bar-engraver.cc
+++ b/lily/span-bar-engraver.cc
@@ -24,6 +24,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 /**
 
 Make bars that span multiple "staves". Catch bars, and span a
diff --git a/lily/span-bar-stub-engraver.cc b/lily/span-bar-stub-engraver.cc
index 3517c3f5fd..5c8fcb6910 100644
--- a/lily/span-bar-stub-engraver.cc
+++ b/lily/span-bar-stub-engraver.cc
@@ -29,6 +29,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 /*
   The Span_bar_stub_engraver creates SpanBarStub grobs in the contexts
   that a grouping context contains.  For example, if a PianoStaff contains
diff --git a/lily/spanner-break-forbid-engraver.cc b/lily/spanner-break-forbid-engraver.cc
index 4a47aade98..89f7233de6 100644
--- a/lily/spanner-break-forbid-engraver.cc
+++ b/lily/spanner-break-forbid-engraver.cc
@@ -26,6 +26,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Spanner_break_forbid_engraver : public Engraver
 {
   TRANSLATOR_DECLARATIONS (Spanner_break_forbid_engraver);
diff --git a/lily/spanner.cc b/lily/spanner.cc
index 3f3d17fb27..c01ac14165 100644
--- a/lily/spanner.cc
+++ b/lily/spanner.cc
@@ -26,6 +26,8 @@
 #include "system.hh"
 #include "warn.hh"
 
+using std::vector;
+
 Grob *
 Spanner::clone () const
 {
diff --git a/lily/spring.cc b/lily/spring.cc
index d1640e72b9..105ae73d1d 100644
--- a/lily/spring.cc
+++ b/lily/spring.cc
@@ -36,6 +36,8 @@
 
 #include "spring.hh"
 
+using std::vector;
+
 Spring::Spring ()
 {
   distance_ = 1.0;
diff --git a/lily/staff-grouper-interface.cc b/lily/staff-grouper-interface.cc
index 55162c2bc7..0d9798cecb 100644
--- a/lily/staff-grouper-interface.cc
+++ b/lily/staff-grouper-interface.cc
@@ -23,6 +23,8 @@
 #include "page-layout-problem.hh"
 #include "pointer-group-interface.hh"
 
+using std::vector;
+
 /* Checks whether the child grob is in the "interior" of this staff-grouper.
    This is the case if the next spaceable, living child after the given one
    belongs to the group.
diff --git a/lily/staff-performer.cc b/lily/staff-performer.cc
index 0648d0aae8..ec4de3e9f8 100644
--- a/lily/staff-performer.cc
+++ b/lily/staff-performer.cc
@@ -31,6 +31,10 @@
 
 #include "translator.icc"
 
+using std::deque;
+using std::map;
+using std::string;
+
 /* Perform a staff. Individual notes should have their instrument
   (staff-wide) set, so we override play_element ()
 */
diff --git a/lily/staff-spacing.cc b/lily/staff-spacing.cc
index c8e51f56f8..d693feaee1 100644
--- a/lily/staff-spacing.cc
+++ b/lily/staff-spacing.cc
@@ -34,6 +34,9 @@ using namespace std;
 #include "pointer-group-interface.hh"
 #include "directional-element-interface.hh"
 
+using std::string;
+using std::vector;
+
 /* A stem following a bar-line creates an optical illusion similar to the
    one mentioned in note-spacing.cc. We correct for it here.
 
diff --git a/lily/staff-symbol.cc b/lily/staff-symbol.cc
index de88102d14..e9ad096326 100644
--- a/lily/staff-symbol.cc
+++ b/lily/staff-symbol.cc
@@ -28,6 +28,8 @@
 #include "staff-symbol-referencer.hh"
 #include "spanner.hh"
 
+using std::vector;
+
 MAKE_SCHEME_CALLBACK (Staff_symbol, print, 1);
 
 SCM
diff --git a/lily/stanza-number-align-engraver.cc b/lily/stanza-number-align-engraver.cc
index c32653abe0..517bb8fe46 100644
--- a/lily/stanza-number-align-engraver.cc
+++ b/lily/stanza-number-align-engraver.cc
@@ -26,6 +26,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Stanza_number_align_engraver : public Engraver
 {
 public:
diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc
index 2f2eaf82da..1d1bb56785 100644
--- a/lily/stem-engraver.cc
+++ b/lily/stem-engraver.cc
@@ -34,6 +34,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 class Stem_engraver : public Engraver
 {
   Grob *stem_;
diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc
index 5f71607a37..f88b41c450 100644
--- a/lily/stem-tremolo.cc
+++ b/lily/stem-tremolo.cc
@@ -31,6 +31,8 @@
 #include "stem.hh"
 #include "warn.hh"
 
+using std::vector;
+
 MAKE_SCHEME_CALLBACK (Stem_tremolo, calc_slope, 1)
 SCM
 Stem_tremolo::calc_slope (SCM smob)
diff --git a/lily/stem.cc b/lily/stem.cc
index 9cb84f57fa..a8105c9402 100644
--- a/lily/stem.cc
+++ b/lily/stem.cc
@@ -61,6 +61,9 @@ using namespace std;
 #include "stem-tremolo.hh"
 #include "warn.hh"
 
+using std::string;
+using std::vector;
+
 void
 Stem::set_beaming (Grob *me, int beam_count, Direction d)
 {
diff --git a/lily/stencil-integral.cc b/lily/stencil-integral.cc
index 747217c847..a6e6d7c84b 100644
--- a/lily/stencil-integral.cc
+++ b/lily/stencil-integral.cc
@@ -57,6 +57,9 @@ when this transforms a point (x,y), the point is written as matrix:
 #include "spanner.hh"
 using namespace std;
 
+using std::string;
+using std::vector;
+
 Real QUANTIZATION_UNIT = 0.2;
 
 void create_path_cap (vector<Box> &boxes,
diff --git a/lily/stencil-scheme.cc b/lily/stencil-scheme.cc
index c8d87439d6..33ae3f5d94 100644
--- a/lily/stencil-scheme.cc
+++ b/lily/stencil-scheme.cc
@@ -22,6 +22,8 @@
 #include "lookup.hh"
 #include "stencil.hh"
 
+using std::vector;
+
 /*
   TODO: naming add/combine.
 */
diff --git a/lily/stencil.cc b/lily/stencil.cc
index 987a879053..34b68d9b3a 100644
--- a/lily/stencil.cc
+++ b/lily/stencil.cc
@@ -25,6 +25,7 @@
 #include "string-convert.hh"
 #include "warn.hh"
 
+using std::vector;
 
 Stencil::Stencil ()
 {
diff --git a/lily/sustain-pedal.cc b/lily/sustain-pedal.cc
index 724059742d..26a5afb564 100644
--- a/lily/sustain-pedal.cc
+++ b/lily/sustain-pedal.cc
@@ -20,6 +20,8 @@
 #include "stencil.hh"
 #include "font-interface.hh"
 
+using std::string;
+
 // update comment --hwn
 /*
   Urg.
diff --git a/lily/system-start-delimiter-engraver.cc b/lily/system-start-delimiter-engraver.cc
index 7eadbb0eec..7d9ce8d47d 100644
--- a/lily/system-start-delimiter-engraver.cc
+++ b/lily/system-start-delimiter-engraver.cc
@@ -28,6 +28,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 struct Bracket_nesting_node
 {
 public:
diff --git a/lily/system.cc b/lily/system.cc
index 0551b85cbc..79c7891bce 100644
--- a/lily/system.cc
+++ b/lily/system.cc
@@ -42,6 +42,8 @@
 #include "unpure-pure-container.hh"
 #include "lily-imports.hh"
 
+using std::vector;
+
 System::System (System const &src)
   : Spanner (src)
 {
diff --git a/lily/tab-note-heads-engraver.cc b/lily/tab-note-heads-engraver.cc
index 4d47d77982..51ea30da01 100644
--- a/lily/tab-note-heads-engraver.cc
+++ b/lily/tab-note-heads-engraver.cc
@@ -36,6 +36,8 @@ using namespace std;
 
 #include "translator.icc"
 
+using std::vector;
+
 /**
    make (guitar-like) tablature note
 */
diff --git a/lily/tab-tie-follow-engraver.cc b/lily/tab-tie-follow-engraver.cc
index b26bf0f6f6..fbc5f0c3b2 100644
--- a/lily/tab-tie-follow-engraver.cc
+++ b/lily/tab-tie-follow-engraver.cc
@@ -30,6 +30,8 @@ using namespace std;
 
 #include "translator.icc"
 
+using std::vector;
+
 /*
    Change tab-note-head properties when a tie is followed by a
    slurs or glissando.
diff --git a/lily/template5.cc b/lily/template5.cc
index 8f9118aee6..4d984b6c22 100644
--- a/lily/template5.cc
+++ b/lily/template5.cc
@@ -23,6 +23,8 @@
 
 #include "interval.tcc"
 
+using std::string;
+
 template<>
 Rational
 Interval_t<Rational>::infinity ()
diff --git a/lily/text-engraver.cc b/lily/text-engraver.cc
index 2a12e75a7a..f885b1ac52 100644
--- a/lily/text-engraver.cc
+++ b/lily/text-engraver.cc
@@ -28,6 +28,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 /**
    typeset directions that are  plain text.
 */
diff --git a/lily/text-interface.cc b/lily/text-interface.cc
index 4598246163..7c5ce5019c 100644
--- a/lily/text-interface.cc
+++ b/lily/text-interface.cc
@@ -35,6 +35,8 @@
 #include "warn.hh"
 #include "lily-imports.hh"
 
+using std::string;
+
 static void
 replace_special_characters (string &str, SCM props)
 {
diff --git a/lily/tie-column.cc b/lily/tie-column.cc
index 5f111a8581..b814e4c442 100644
--- a/lily/tie-column.cc
+++ b/lily/tie-column.cc
@@ -33,6 +33,7 @@
 #include "tie-configuration.hh"
 
 using namespace std;
+using std::vector;
 
 void
 Tie_column::add_tie (Grob *tc, Spanner *tie)
diff --git a/lily/tie-configuration.cc b/lily/tie-configuration.cc
index 19a2c68f72..968bfd65ad 100644
--- a/lily/tie-configuration.cc
+++ b/lily/tie-configuration.cc
@@ -24,6 +24,8 @@
 #include "tie-formatting-problem.hh"
 #include "bezier.hh"
 
+using std::string;
+
 int
 Tie_configuration::compare (Tie_configuration const &a,
                             Tie_configuration const &b)
diff --git a/lily/tie-engraver.cc b/lily/tie-engraver.cc
index 56fb4a337d..916c7fecd1 100644
--- a/lily/tie-engraver.cc
+++ b/lily/tie-engraver.cc
@@ -34,6 +34,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 /**
    Manufacture ties.  Acknowledge note heads, and put them into a
    priority queue. If we have a TieEvent, connect the notes that finish
diff --git a/lily/tie-formatting-problem.cc b/lily/tie-formatting-problem.cc
index 905718469c..6a5e62fde1 100644
--- a/lily/tie-formatting-problem.cc
+++ b/lily/tie-formatting-problem.cc
@@ -39,6 +39,10 @@
 #include "pointer-group-interface.hh"
 #include "output-def.hh"
 
+using std::set;
+using std::string;
+using std::vector;
+
 void
 Tie_formatting_problem::print_ties_configuration (Ties_configuration const *ties)
 {
diff --git a/lily/tie-performer.cc b/lily/tie-performer.cc
index b1aa15ffeb..b589ec5646 100644
--- a/lily/tie-performer.cc
+++ b/lily/tie-performer.cc
@@ -25,6 +25,8 @@
 #include "translator.icc"
 #include <list>
 
+using std::list;
+
 struct Head_audio_event_tuple
 {
   Audio_element_info head_;
diff --git a/lily/tie.cc b/lily/tie.cc
index dcc53ad44e..0cd3eb75b8 100644
--- a/lily/tie.cc
+++ b/lily/tie.cc
@@ -41,6 +41,8 @@
 #include "warn.hh"
 #include "semi-tie-column.hh"
 
+using std::string;
+
 bool
 Tie::less (Grob *g1, Grob *g2)
 {
diff --git a/lily/translator-group.cc b/lily/translator-group.cc
index 831a4790b0..99026ca051 100644
--- a/lily/translator-group.cc
+++ b/lily/translator-group.cc
@@ -35,6 +35,8 @@
 #include "scm-hash.hh"
 #include "warn.hh"
 
+using std::vector;
+
 void
 translator_each (SCM list, Translator_method method)
 {
diff --git a/lily/translator.cc b/lily/translator.cc
index 370f7771c0..a277eab16d 100644
--- a/lily/translator.cc
+++ b/lily/translator.cc
@@ -28,6 +28,9 @@
 
 #include "translator.icc"
 
+using std::string;
+using std::vector;
+
 Translator::~Translator ()
 {
 }
diff --git a/lily/ttf.cc b/lily/ttf.cc
index 2af774e414..dedd83cd88 100644
--- a/lily/ttf.cc
+++ b/lily/ttf.cc
@@ -29,6 +29,9 @@
 #include "main.hh"
 #include "open-type-font.hh"
 
+using std::string;
+using std::vector;
+
 Index_to_charcode_map
 make_index_to_charcode_map (FT_Face face)
 {
diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc
index 17e1194de8..1bad21ba40 100644
--- a/lily/tuplet-bracket.cc
+++ b/lily/tuplet-bracket.cc
@@ -59,6 +59,8 @@
 #include "paper-column.hh"
 #include "moment.hh"
 
+using std::vector;
+
 static Item *
 get_x_bound_item (Grob *me_grob, Direction hdir, Direction my_dir)
 {
diff --git a/lily/tuplet-engraver.cc b/lily/tuplet-engraver.cc
index 369389200f..80067dd13f 100644
--- a/lily/tuplet-engraver.cc
+++ b/lily/tuplet-engraver.cc
@@ -30,6 +30,8 @@
 
 #include "translator.icc"
 
+using std::vector;
+
 struct Tuplet_description
 {
   Stream_event *event_;
diff --git a/lily/tuplet-number.cc b/lily/tuplet-number.cc
index 4d879ade4c..df97093988 100644
--- a/lily/tuplet-number.cc
+++ b/lily/tuplet-number.cc
@@ -34,6 +34,8 @@
 #include "stem.hh"
 #include "warn.hh"
 
+using std::vector;
+
 /*
   The reference stem is used to determine on which side of the beam to place
   the tuplet number when it is positioned independently of a bracket.  (The number
diff --git a/lily/undead.cc b/lily/undead.cc
index a328c66caf..51fa3c0a39 100644
--- a/lily/undead.cc
+++ b/lily/undead.cc
@@ -19,6 +19,8 @@
 
 #include "smobs.hh"
 
+using std::vector;
+
 class Undead : public Simple_smob<Undead>
 {
 public:
diff --git a/lily/vaticana-ligature-engraver.cc b/lily/vaticana-ligature-engraver.cc
index 2d94c03892..f0e14849e8 100644
--- a/lily/vaticana-ligature-engraver.cc
+++ b/lily/vaticana-ligature-engraver.cc
@@ -35,6 +35,9 @@
 #include "pitch.hh"
 #include "translator.icc"
 
+using std::string;
+using std::vector;
+
 /*
  * This class implements the notation specific aspects of Vaticana
  * style ligatures for Gregorian chant notation.
diff --git a/lily/vaticana-ligature.cc b/lily/vaticana-ligature.cc
index ddbe0d86bd..eb38442c3f 100644
--- a/lily/vaticana-ligature.cc
+++ b/lily/vaticana-ligature.cc
@@ -29,6 +29,8 @@
 #include "staff-symbol-referencer.hh"
 #include "warn.hh"
 
+using std::string;
+
 Stencil
 vaticana_brew_cauda (Grob *me,
                      int pos,
diff --git a/lily/vertical-align-engraver.cc b/lily/vertical-align-engraver.cc
index 6a47809fd7..0d1f757c59 100644
--- a/lily/vertical-align-engraver.cc
+++ b/lily/vertical-align-engraver.cc
@@ -29,6 +29,9 @@
 
 #include "translator.icc"
 
+using std::string;
+using std::vector;
+
 class Vertical_align_engraver : public Engraver
 {
   Spanner *valign_;
diff --git a/lily/volta-bracket.cc b/lily/volta-bracket.cc
index 9ac2b44637..b135e8e198 100644
--- a/lily/volta-bracket.cc
+++ b/lily/volta-bracket.cc
@@ -34,6 +34,8 @@ using namespace std;
 #include "tuplet-bracket.hh"
 #include "lily-imports.hh"
 
+using std::string;
+
 /*
   this is too complicated. Yet another version of side-positioning,
   badly implemented.
diff --git a/lily/volta-repeat-iterator.cc b/lily/volta-repeat-iterator.cc
index 85a2c127ab..32561674f1 100644
--- a/lily/volta-repeat-iterator.cc
+++ b/lily/volta-repeat-iterator.cc
@@ -22,6 +22,8 @@
 #include "context.hh"
 #include "lily-imports.hh"
 
+using std::string;
+
 class Volta_repeat_iterator : public Sequential_iterator
 {
 public:
diff --git a/lily/warn-scheme.cc b/lily/warn-scheme.cc
index cd9efc9ad4..fe6729d112 100644
--- a/lily/warn-scheme.cc
+++ b/lily/warn-scheme.cc
@@ -26,6 +26,8 @@
 #include "international.hh"
 #include "warn.hh"
 
+using std::string;
+
 /*
   Error / warning / progress / debug message output functions
 */
-- 
2.39.5