From 3b8a9dd6ecc8f8bb0674e215fa59dfc8d3ad0c2a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 24 Apr 2014 09:47:59 +0200 Subject: util/{Const,Writable}Buffer: add typedef reference_type --- src/util/ConstBuffer.hxx | 6 ++++-- src/util/WritableBuffer.hxx | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/util') diff --git a/src/util/ConstBuffer.hxx b/src/util/ConstBuffer.hxx index 2670489b1..bb114d44d 100644 --- a/src/util/ConstBuffer.hxx +++ b/src/util/ConstBuffer.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Max Kellermann + * Copyright (C) 2013-2014 Max Kellermann * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -86,6 +86,8 @@ struct ConstBuffer { template struct ConstBuffer { typedef size_t size_type; + typedef const T &reference_type; + typedef reference_type const_reference_type; typedef const T *pointer_type; typedef pointer_type const_pointer_type; typedef pointer_type iterator; @@ -155,7 +157,7 @@ struct ConstBuffer { #ifdef NDEBUG constexpr #endif - const T &operator[](size_type i) const { + reference_type operator[](size_type i) const { #ifndef NDEBUG assert(i < size); #endif diff --git a/src/util/WritableBuffer.hxx b/src/util/WritableBuffer.hxx index d13f80867..1fe1b254f 100644 --- a/src/util/WritableBuffer.hxx +++ b/src/util/WritableBuffer.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Max Kellermann + * Copyright (C) 2013-2014 Max Kellermann * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -80,6 +80,8 @@ struct WritableBuffer { template struct WritableBuffer { typedef size_t size_type; + typedef T &reference_type; + typedef const T &const_reference_type; typedef T *pointer_type; typedef const T *const_pointer_type; typedef pointer_type iterator; @@ -149,7 +151,7 @@ struct WritableBuffer { #ifdef NDEBUG constexpr #endif - T &operator[](size_type i) const { + reference_type operator[](size_type i) const { #ifndef NDEBUG assert(i < size); #endif -- cgit v1.2.3