Replace using with typedef for compatibility with gcc-4.6
diff --git a/include/fmt/core.h b/include/fmt/core.h
index 5da04ed..1c56cd4 100644
--- a/include/fmt/core.h
+++ b/include/fmt/core.h
@@ -168,8 +168,8 @@
   size_t size_;
 
  public:
-  using char_type = Char;
-  using iterator = const Char *;
+  typedef Char char_type;
+  typedef const Char *iterator;
 
   FMT_CONSTEXPR basic_string_view() FMT_NOEXCEPT : data_(0), size_(0) {}
 
@@ -242,8 +242,8 @@
 #endif
 
 namespace fmt {
-using string_view = basic_string_view<char>;
-using wstring_view = basic_string_view<wchar_t>;
+typedef basic_string_view<char> string_view;
+typedef basic_string_view<wchar_t> wstring_view;
 
 template <typename Context>
 class basic_arg;
@@ -285,7 +285,7 @@
   virtual void grow(std::size_t capacity) = 0;
 
  public:
-  using value_type = T;
+  typedef T value_type;
 
   virtual ~basic_buffer() {}
 
@@ -335,8 +335,8 @@
   const T &operator[](std::size_t index) const { return ptr_[index]; }
 };
 
-using buffer = basic_buffer<char>;
-using wbuffer = basic_buffer<wchar_t>;
+typedef basic_buffer<char> buffer;
+typedef basic_buffer<wchar_t> wbuffer;
 
 // A container-backed buffer.
 template <typename Container>
@@ -443,7 +443,7 @@
 template <typename Context>
 class value {
  public:
-  using char_type = typename Context::char_type;
+  typedef typename Context::char_type char_type;
 
   union {
     int int_value;
@@ -499,7 +499,7 @@
     // Get the formatter type through the context to allow different contexts
     // have different extension points, e.g. `formatter<T>` for `format` and
     // `printf_formatter<T>` for `printf`.
-    typename Context::template formatter_type<T> f;
+    typename Context::template formatter_type<T>::type f;
     auto &&parse_ctx = ctx.parse_context();
     parse_ctx.advance_to(f.parse(parse_ctx));
     ctx.advance_to(f.format(*static_cast<const T*>(arg), ctx));
@@ -531,12 +531,11 @@
 
 // To minimize the number of types we need to deal with, long is translated
 // either to int or to long long depending on its size.
-using long_type =
-  std::conditional<sizeof(long) == sizeof(int), int, long long>::type;
+typedef std::conditional<sizeof(long) == sizeof(int), int, long long>::type
+        long_type;
 FMT_MAKE_VALUE((sizeof(long) == sizeof(int) ? INT : LONG_LONG), long, long_type)
-using ulong_type =
-  std::conditional<sizeof(unsigned long) == sizeof(unsigned),
-                   unsigned, unsigned long long>::type;
+typedef std::conditional<sizeof(unsigned long) == sizeof(unsigned),
+                         unsigned, unsigned long long>::type ulong_type;
 FMT_MAKE_VALUE((sizeof(unsigned long) == sizeof(unsigned) ? UINT : ULONG_LONG),
     unsigned long, ulong_type)
 
@@ -628,7 +627,7 @@
   friend class basic_format_args<Context>;
   friend class internal::arg_map<Context>;
 
-  using char_type = typename Context::char_type;
+  typedef typename Context::char_type char_type;
 
  public:
   class handle {
@@ -663,8 +662,8 @@
   int next_arg_id_;
 
  public:
-  using char_type = Char;
-  using iterator = typename basic_string_view<Char>::iterator;
+  typedef Char char_type;
+  typedef typename basic_string_view<Char>::iterator iterator;
 
   explicit FMT_CONSTEXPR basic_parse_context(
       basic_string_view<Char> format_str, ErrorHandler eh = ErrorHandler())
@@ -704,8 +703,8 @@
   FMT_CONSTEXPR ErrorHandler error_handler() const { return *this; }
 };
 
-using parse_context = basic_parse_context<char>;
-using wparse_context = basic_parse_context<wchar_t>;
+typedef basic_parse_context<char> parse_context;
+typedef basic_parse_context<wchar_t> wparse_context;
 
 namespace internal {
 // A map from argument names to their values for named arguments.
@@ -714,7 +713,7 @@
  private:
   FMT_DISALLOW_COPY_AND_ASSIGN(arg_map);
 
-  using char_type = typename Context::char_type;
+  typedef typename Context::char_type char_type;
 
   struct entry {
     basic_string_view<char_type> name;
@@ -748,7 +747,7 @@
 template <typename OutputIt, typename Context, typename Char>
 class context_base {
  public:
-  using iterator = OutputIt;
+  typedef OutputIt iterator;
 
  private:
   basic_parse_context<Char> parse_context_;
@@ -756,8 +755,8 @@
   basic_format_args<Context> args_;
 
  protected:
-  using char_type = Char;
-  using format_arg = basic_arg<Context>;
+  typedef Char char_type;
+  typedef basic_arg<Context> format_arg;
 
   context_base(OutputIt out, basic_string_view<char_type> format_str,
                basic_format_args<Context> args)
@@ -801,7 +800,7 @@
 // Extracts a reference to the container from back_insert_iterator.
 template <typename Container>
 inline Container &get_container(std::back_insert_iterator<Container> it) {
-  using iterator = std::back_insert_iterator<Container>;
+  typedef std::back_insert_iterator<Container> iterator;
   struct accessor: iterator {
     accessor(iterator it) : iterator(it) {}
     using iterator::container;
@@ -816,11 +815,11 @@
   OutputIt it_;
 
   // Unused yet.
-  using sentinel = void;
+  typedef void sentinel;
   sentinel end() const;
 
  public:
-  using value_type = T;
+  typedef T value_type;
 
   explicit output_range(OutputIt it): it_(it) {}
   OutputIt begin() const { return it_; }
@@ -832,18 +831,19 @@
   public internal::context_base<OutputIt, basic_context<OutputIt, Char>, Char> {
  public:
   /** The character type for the output. */
-  using char_type = Char;
+  typedef Char char_type;
 
+  // using formatter_type = formatter<T, char_type>;
   template <typename T>
-  using formatter_type = formatter<T, char_type>;
+  struct formatter_type { typedef formatter<T, char_type> type; };
 
  private:
   internal::arg_map<basic_context> map_;
 
   FMT_DISALLOW_COPY_AND_ASSIGN(basic_context);
 
-  using base = internal::context_base<OutputIt, basic_context, Char>;
-  using format_arg = typename base::format_arg;
+  typedef internal::context_base<OutputIt, basic_context, Char> base;
+  typedef typename base::format_arg format_arg;
   using base::get_arg;
 
  public:
@@ -872,8 +872,8 @@
 template <typename Char>
 using buffer_context_t = basic_context<
   std::back_insert_iterator<internal::basic_buffer<Char>>, Char>;
-using context = buffer_context_t<char>;
-using wcontext = buffer_context_t<wchar_t>;
+typedef buffer_context_t<char> context;
+typedef buffer_context_t<wchar_t> wcontext;
 
 namespace internal {
 template <typename Context, typename T>
@@ -882,7 +882,7 @@
   static const T& val();
 
  public:
-  using value_type = decltype(make_value<Context>(val()));
+  typedef decltype(make_value<Context>(val())) value_type;
   static const type value = value_type::type_tag;
 };
 
@@ -923,8 +923,8 @@
   // Packed is a macro on MinGW so use IS_PACKED instead.
   static const bool IS_PACKED = NUM_ARGS < internal::MAX_PACKED_ARGS;
 
-  using value_type = typename std::conditional<
-    IS_PACKED, internal::value<Context>, basic_arg<Context>>::type;
+  typedef typename std::conditional<
+    IS_PACKED, internal::value<Context>, basic_arg<Context>>::type value_type;
 
   // If the arguments are not packed, add one more element to mark the end.
   value_type data_[NUM_ARGS + (IS_PACKED && NUM_ARGS != 0 ? 0 : 1)];
@@ -959,8 +959,8 @@
 template <typename Context>
 class basic_format_args {
  public:
-  using size_type = unsigned;
-  using format_arg = basic_arg<Context> ;
+  typedef unsigned size_type;
+  typedef basic_arg<Context>  format_arg;
 
  private:
   // To reduce compiled code size per formatting function call, types of first
@@ -1028,8 +1028,8 @@
   }
 };
 
-using format_args = basic_format_args<context>;
-using wformat_args = basic_format_args<wcontext>;
+typedef basic_format_args<context> format_args;
+typedef basic_format_args<wcontext> wformat_args;
 
 namespace internal {
 template <typename Char>
diff --git a/include/fmt/format.h b/include/fmt/format.h
index 6271642..2a66c9f 100644
--- a/include/fmt/format.h
+++ b/include/fmt/format.h
@@ -575,11 +575,11 @@
 template <typename Char>
 class null_terminating_iterator {
  public:
-  using difference_type = std::ptrdiff_t;
-  using value_type = Char;
-  using pointer = const Char*;
-  using reference = const Char&;
-  using iterator_category = std::random_access_iterator_tag;
+  typedef std::ptrdiff_t difference_type;
+  typedef Char value_type;
+  typedef const Char* pointer;
+  typedef const Char& reference;
+  typedef std::random_access_iterator_tag iterator_category;
 
   null_terminating_iterator() : ptr_(0), end_(0) {}
 
@@ -667,11 +667,11 @@
   mutable T blackhole_;
 
  public:
-  using iterator_category = std::output_iterator_tag;
-  using value_type = T;
-  using difference_type = std::ptrdiff_t;
-  using pointer = T*;
-  using reference = T&;
+  typedef std::output_iterator_tag iterator_category;
+  typedef T value_type;
+  typedef std::ptrdiff_t difference_type;
+  typedef T* pointer;
+  typedef T& reference;
 
   explicit counting_iterator(std::size_t &count): count_(count) {}
   counting_iterator(const counting_iterator &other): count_(other.count_) {}
@@ -998,7 +998,7 @@
 template <typename Visitor, typename Context>
 FMT_CONSTEXPR typename std::result_of<Visitor(int)>::type
     visit(Visitor &&vis, basic_arg<Context> arg) {
-  using char_type = typename Context::char_type;
+  typedef typename Context::char_type char_type;
   switch (arg.type_) {
   case internal::NONE:
     return vis(monostate());
@@ -1058,7 +1058,7 @@
 };
 
 // template <typename Char>
-// using fill_spec = format_spec<Char, fill_tag>;
+// typedef format_spec<Char, fill_tag> fill_spec;
 template <typename Char>
 class fill_spec : public format_spec<Char, fill_tag> {
  public:
@@ -1323,11 +1323,11 @@
 template <typename Range>
 class arg_formatter_base {
  public:
-  using char_type = typename Range::value_type;
-  using format_specs = basic_format_specs<char_type>;
+  typedef typename Range::value_type char_type;
+  typedef basic_format_specs<char_type> format_specs;
 
  private:
-  using writer_type = basic_writer<Range>;
+  typedef basic_writer<Range> writer_type;
   writer_type writer_;
   format_specs &specs_;
 
@@ -1717,7 +1717,7 @@
 class dynamic_specs_handler :
     public specs_setter<typename ParseContext::char_type> {
  public:
-  using char_type = typename ParseContext::char_type;
+  typedef typename ParseContext::char_type char_type;
 
   FMT_CONSTEXPR dynamic_specs_handler(
       dynamic_format_specs<char_type> &specs, ParseContext &ctx)
@@ -1742,7 +1742,7 @@
   }
 
  private:
-  using arg_ref_type = arg_ref<char_type>;
+  typedef arg_ref<char_type> arg_ref_type;
 
   template <typename Id>
   FMT_CONSTEXPR arg_ref_type make_arg_ref(Id arg_id) {
@@ -1760,7 +1760,7 @@
 
 template <typename Iterator, typename IDHandler>
 FMT_CONSTEXPR Iterator parse_arg_id(Iterator it, IDHandler &&handler) {
-  using char_type = typename std::iterator_traits<Iterator>::value_type;
+  typedef typename std::iterator_traits<Iterator>::value_type char_type;
   char_type c = *it;
   if (c == '}' || c == ':') {
     handler();
@@ -1830,7 +1830,7 @@
 //     format specifiers.
 template <typename Iterator, typename SpecHandler>
 FMT_CONSTEXPR Iterator parse_format_specs(Iterator it, SpecHandler &&handler) {
-  using char_type = typename std::iterator_traits<Iterator>::value_type;
+  typedef typename std::iterator_traits<Iterator>::value_type char_type;
   // Parse fill and alignment.
   if (char_type c = *it) {
     alignment align = ALIGN_DEFAULT;
@@ -1949,7 +1949,7 @@
 
 template <typename Iterator, typename Handler>
 FMT_CONSTEXPR void parse_format_string(Iterator it, Handler &&handler) {
-  using char_type = typename std::iterator_traits<Iterator>::value_type;
+  typedef typename std::iterator_traits<Iterator>::value_type char_type;
   auto start = it;
   while (*it) {
     char_type ch = *it++;
@@ -2025,7 +2025,7 @@
   }
 
  private:
-  using parse_context_type = basic_parse_context<Char, ErrorHandler>;
+  typedef basic_parse_context<Char, ErrorHandler> parse_context_type;
   enum { NUM_ARGS = sizeof...(Args) };
 
   FMT_CONSTEXPR void check_arg_id() {
@@ -2034,7 +2034,7 @@
   }
 
   // Format specifier parsing function.
-  using parse_func = const Char *(*)(parse_context_type &);
+  typedef const Char *(*parse_func)(parse_context_type &);
 
   int arg_id_ = -1;
   parse_context_type context_;
@@ -2065,7 +2065,7 @@
 template <template <typename> class Handler, typename Spec, typename Context>
 void handle_dynamic_spec(
     Spec &value, arg_ref<typename Context::char_type> ref, Context &ctx) {
-  using char_type = typename Context::char_type;
+  typedef typename Context::char_type char_type;
   switch (ref.kind) {
   case arg_ref<char_type>::NONE:
     break;
@@ -2085,16 +2085,16 @@
 template <typename Range>
 class arg_formatter: public internal::arg_formatter_base<Range> {
  private:
-  using char_type = typename Range::value_type;
-  using iterator = decltype(std::declval<Range>().begin());
-  using base = internal::arg_formatter_base<Range>;
-  using context_type = basic_context<iterator, char_type>;
+  typedef typename Range::value_type char_type;
+  typedef decltype(std::declval<Range>().begin()) iterator;
+  typedef internal::arg_formatter_base<Range> base;
+  typedef basic_context<iterator, char_type> context_type;
 
   context_type &ctx_;
 
  public:
-  using range = Range;
-  using format_specs = typename base::format_specs;
+  typedef Range range;
+  typedef typename base::format_specs format_specs;
 
   /**
     \rst
@@ -2183,9 +2183,9 @@
 template <typename Range>
 class basic_writer {
  public:
-  using char_type = typename Range::value_type;
-  using iterator = decltype(std::declval<Range>().begin());
-  using format_specs = basic_format_specs<char_type>;
+  typedef typename Range::value_type char_type;
+  typedef decltype(std::declval<Range>().begin()) iterator;
+  typedef basic_format_specs<char_type> format_specs;
 
  private:
   // Output iterator.
@@ -2196,11 +2196,11 @@
   FMT_DISALLOW_COPY_AND_ASSIGN(basic_writer);
 
 #if FMT_SECURE_SCL
-  using pointer_type = stdext::checked_array_iterator<char_type*>;
+  typedef stdext::checked_array_iterator<char_type*> pointer_type;
   // Returns pointer value.
   static char_type *get(pointer_type p) { return p.base(); }
 #else
-  using pointer_type = char_type*;
+  typedef char_type* pointer_type;
   static char_type *get(char_type *p) { return p; }
 #endif
 
@@ -2260,7 +2260,7 @@
   // Writes a decimal integer.
   template <typename Int>
   void write_decimal(Int value) {
-    using main_type = typename internal::int_traits<Int>::main_type;
+    typedef typename internal::int_traits<Int>::main_type main_type;
     main_type abs_value = static_cast<main_type>(value);
     bool is_negative = internal::is_negative(value);
     if (is_negative)
@@ -2275,7 +2275,7 @@
   // The handle_int_type_spec handler that writes an integer.
   template <typename Int, typename Spec>
   struct int_writer {
-    using unsigned_type = typename internal::int_traits<Int>::main_type;
+    typedef typename internal::int_traits<Int>::main_type unsigned_type;
 
     basic_writer<Range> &writer;
     const Spec &spec;
@@ -2731,16 +2731,16 @@
 template <typename Container>
 class back_insert_range:
     public output_range<std::back_insert_iterator<Container>> {
-  using base = output_range<std::back_insert_iterator<Container>>;
+  typedef output_range<std::back_insert_iterator<Container>> base;
  public:
-  using value_type = typename Container::value_type;
+  typedef typename Container::value_type value_type;
 
   using base::base;
   back_insert_range(Container &c): base(std::back_inserter(c)) {}
 };
 
-using writer = basic_writer<back_insert_range<internal::buffer>>;
-using wwriter = basic_writer<back_insert_range<internal::wbuffer>>;
+typedef basic_writer<back_insert_range<internal::buffer>> writer;
+typedef basic_writer<back_insert_range<internal::wbuffer>> wwriter;
 
 // Reports a system error without throwing an exception.
 // Can be used to report errors from destructors.
@@ -2878,7 +2878,7 @@
 // write a terminating null character.
 template <typename T>
 inline void format_decimal(char *&buffer, T value) {
-  using main_type = typename internal::int_traits<T>::main_type;
+  typedef typename internal::int_traits<T>::main_type main_type;
   main_type abs_value = static_cast<main_type>(value);
   if (internal::is_negative(value)) {
     *buffer++ = '-';
@@ -2911,7 +2911,7 @@
   template <typename ParseContext>
   FMT_CONSTEXPR typename ParseContext::iterator parse(ParseContext &ctx) {
     auto it = internal::null_terminating_iterator<Char>(ctx);
-    using handler_type = internal::dynamic_specs_handler<ParseContext>;
+    typedef internal::dynamic_specs_handler<ParseContext> handler_type;
     auto type = internal::get_type<buffer_context_t<Char>, T>::value;
     internal::specs_checker<handler_type>
         handler(handler_type(specs_, ctx), type);
@@ -2964,8 +2964,8 @@
       specs_.width_, specs_.width_ref, ctx);
     internal::handle_dynamic_spec<internal::precision_checker>(
       specs_.precision_, specs_.precision_ref, ctx);
-    using range = output_range<
-      typename FormatContext::iterator, typename FormatContext::char_type>;
+    typedef output_range<typename FormatContext::iterator,
+                         typename FormatContext::char_type> range;
     visit(arg_formatter<range>(ctx, specs_),
           internal::make_arg<FormatContext>(val));
     return ctx.begin();
@@ -2988,7 +2988,7 @@
 // A formatter for types known only at run time such as variant alternatives.
 //
 // Usage:
-//   using variant = std::variant<int, std::string>;
+//   typedef std::variant<int, std::string> variant;
 //   template <>
 //   struct formatter<variant>: dynamic_formatter<> {
 //     void format(buffer &buf, const variant &v, context &ctx) {
@@ -3033,8 +3033,8 @@
     }
     if (specs_.precision_ != -1)
       checker.end_precision();
-    using range = output_range<
-      typename FormatContext::iterator, typename FormatContext::char_type>;
+    typedef output_range<typename FormatContext::iterator,
+                         typename FormatContext::char_type> range;
     visit(arg_formatter<range>(ctx, specs_),
           internal::make_arg<FormatContext>(val));
     return ctx.begin();
@@ -3067,8 +3067,8 @@
 typename Context::iterator do_vformat_to(typename ArgFormatter::range out,
                                          basic_string_view<Char> format_str,
                                          basic_format_args<Context> args) {
-  using iterator = internal::null_terminating_iterator<Char>;
-  using range = typename ArgFormatter::range;
+  typedef internal::null_terminating_iterator<Char> iterator;
+  typedef typename ArgFormatter::range range;
 
   struct handler : internal::error_handler {
     handler(range r, basic_string_view<Char> str,
@@ -3171,7 +3171,7 @@
     formatter<typename std::iterator_traits<It>::value_type, Char> {
   template <typename FormatContext>
   auto format(const arg_join<It, Char> &value, FormatContext &ctx) {
-    using base = formatter<typename std::iterator_traits<It>::value_type, Char>;
+    typedef formatter<typename std::iterator_traits<It>::value_type, Char> base;
     auto it = value.begin;
     auto out = ctx.begin(); 
     if (it != value.end) {
@@ -3244,13 +3244,13 @@
 
 inline void vformat_to(internal::buffer &buf, string_view format_str,
                        format_args args) {
-  using range = back_insert_range<internal::buffer>;
+  typedef back_insert_range<internal::buffer> range;
   do_vformat_to<arg_formatter<range>>(buf, format_str, args);
 }
 
 inline void vformat_to(internal::wbuffer &buf, wstring_view format_str,
                        wformat_args args) {
-  using range = back_insert_range<internal::wbuffer>;
+  typedef back_insert_range<internal::wbuffer> range;
   do_vformat_to<arg_formatter<range>>(buf, format_str, args);
 }
 
@@ -3275,7 +3275,7 @@
 template <typename OutputIt, typename... Args>
 inline OutputIt vformat_to(OutputIt out, string_view format_str,
                            format_args_t<OutputIt> args) {
-  using range = output_range<OutputIt, char>;
+  typedef output_range<OutputIt, char> range;
   return do_vformat_to<arg_formatter<range>>(range(out), format_str, args);
 }
 
diff --git a/include/fmt/printf.h b/include/fmt/printf.h
index 522d8d0..f25a8b6 100644
--- a/include/fmt/printf.h
+++ b/include/fmt/printf.h
@@ -309,7 +309,7 @@
   using char_type = Char;
 
   template <typename T>
-  using formatter_type = printf_formatter<T>;
+  struct formatter_type { typedef printf_formatter<T> type; };
 
  private:
   using base = internal::context_base<OutputIt, basic_printf_context, Char>;
diff --git a/test/util-test.cc b/test/util-test.cc
index 47cf21c..54296a7 100644
--- a/test/util-test.cc
+++ b/test/util-test.cc
@@ -440,15 +440,17 @@
 
   template <typename T>
   struct formatter_type {
-    template <typename ParseContext>
-    auto parse(ParseContext &ctx) -> decltype(ctx.begin()) {
-      return ctx.begin();
-    }
+    struct type {
+      template <typename ParseContext>
+      auto parse(ParseContext &ctx) -> decltype(ctx.begin()) {
+        return ctx.begin();
+      }
 
-    const char *format(const T &, custom_context& ctx) {
-      ctx.called = true;
-      return 0;
-    }
+      const char *format(const T &, custom_context& ctx) {
+        ctx.called = true;
+        return 0;
+      }
+    };
   };
 
   bool called;