This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Remove is_merge_section_for


>    Input_merge_map*
>    get_input_merge_map(unsigned int shndx);
>
> +  const Input_merge_map*
> +  get_input_merge_map(unsigned int shndx) const {
> +    return const_cast<Object_merge_map*>(this)->get_input_merge_map(shndx);
> +  }
>
> When you need both const and non-const versions of a method, have the
> non-const version call the const version, instead of the other way
> around.
>

I did as asked, but now we need two casts:

 Input_merge_map *
  get_input_merge_map(unsigned int shndx) {
    return const_cast<Input_merge_map *>(static_cast<const Object_merge_map *>(
                                             this)->get_input_merge_map(shndx));
  }

Are you sure this is better?

Cheers,
Rafael


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]