Thread: Got a problem with "opImplConv()"

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Jun 2019
    Posts
    5

    Question Got a problem with "opImplConv()"

    When I use opImplConv() to implicitly convert string_t to string, log file says it matches multiple signatures, so the plugin cannot be compiled. Then I find that there are two opImplConv()
    string opImplConv() const Converts this string_t to a string.
    int opImplConv() const Converts this string_t to an integer.

    How can we use two methods with the same name, different return type and without any argument properly? Searched over net still no answer.
    Last edited by Razer; 14-06-2019 at 06:11 AM.

  2. #2
    Still learning wolf-3d's Avatar  
    Tester
    Join Date
    Jan 2011
    Location
    Somewhere Warm.
    Posts
    1,474

    Re: Got a problem with "opImplConv()"

    This may help, else ask for additional info. and help:
    https://en.wikipedia.org/wiki/Function_overloading
    Last edited by wolf-3d; 14-06-2019 at 10:39 AM. Reason: Spelling correction
    Regards
    Wolf-3D

  3. #3
    Registered User
    Join Date
    Jun 2019
    Posts
    5

    Re: Got a problem with "opImplConv()"

    Thx for your help. It does not seem to be conventional function overload, which at least has different arguments among multiple methods.
    This opImplConv() is actually a method of string_t. An example how I use it would cause compiling error:
    Code:
    CBasePlayer@ cplayer;
    string a = cplayer.pev.netname.opImplConv();
    netname is a string_t which returns the net name the cplayer uses. However, when I tried to use opImplConv() to convert it to string implicitly, error log is like
    Code:
    Multiple signatures matching string_t::opImplConv()

  4. #4
    200 MB Angelscript log file KernCore's Avatar  
    Artist
    Join Date
    Apr 2016
    Location
    Brazil
    Posts
    273

    Re: Got a problem with "opImplConv()"

    Quote Originally Posted by Razer View Post
    Thx for your help. It does not seem to be conventional function overload, which at least has different arguments among multiple methods.
    This opImplConv() is actually a method of string_t. An example how I use it would cause compiling error:
    Code:
    CBasePlayer@ cplayer;
    string a = cplayer.pev.netname.opImplConv();
    netname is a string_t which returns the net name the cplayer uses. However, when I tried to use opImplConv() to convert it to string implicitly, error log is like
    Code:
    Multiple signatures matching string_t::opImplConv()
    does it really need the opImplConv() part? Have you tried without it?

  5. #5
    Registered User
    Join Date
    Jun 2019
    Posts
    5

    Re: Got a problem with "opImplConv()"

    Well, I use string(cplayer.pev.netname) to force conversion, seems it works. But the existence of opImplConv() rises my curiosity that, how could they manage to have this as an API, wouldn't it cause compiling error or something?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •