[patch] Remove is_merge_section_for

Rafael Espíndola rafael.espindola@gmail.com
Mon Mar 23 13:25:00 GMT 2015


>    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



More information about the Binutils mailing list