Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 269161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:47:33+00:00 2026-05-11T23:47:33+00:00

I’m trying to fix something in some Objective C++ (?!) code. I don’t know

  • 0

I’m trying to fix something in some Objective C++ (?!) code. I don’t know either of those languages, or any of the relevant APIs or the codebase, so I’m getting stymied left and right.

Say I have:

Vector<char, sizeof 'a'>& sourceData();
sourceData->append('f');

When i try to compile that, I get:

error: request for member ‘append’ in ‘WebCore::sourceData’, which is of non-class type ‘WTF::Vector<char, 1ul >& ()();

In this case, Vector is WTF::Vector (from WebKit or KDE or something), not STD::Vector. append() very much is supposed to be a member of class generated from this template, as seen in this documentation. It’s a Vector. It takes the type the template is templated on.

Now, because I never write programs in Real Man’s programming languages, I’m hella confused about the notations for references and pointers and dereferences and where we need them.

I ultimately want a Vector reference, because I want to pass it to another function with the signature:

void foobar(const Vector<char>& in, Vector<char>& out)

I’m guessing the const in the foobar() sig is something I can ignore, meaning ‘dont worry, this won’t be mangled if you pass it in here’.

I’ve also tried using .append rather than -> because isn’t one of the things of C++ references that you can treat them more like they aren’t pointers? Either way, its the same error.

I can’t quite follow the error message: it makes it sound like sourceData is of type WTF:Vector<char, 1ul>&, which is what I want. It also looks from the those docs of WTF::Vector that when you make a Vector of something, you get an .append(). But I’m not familiar with templates, either, so I can’t really tell i I’m reading that right.

EDIT:

(This is a long followup to Pavel Minaev)
WOW THANKS PROBLEM SOLVED!

I was actually just writing an edit to this post that I semi-figured out your first point after coming across a reference on the web that that line tells the compiler your forward declaring a func called sourceData() that takes no params and returns a Vector of chars. so a “non-class type” in this case means a type that is not an instance of a class. I interpreted that as meaning that the type was not a ‘klass’, i.e. the type of thing you would expect you could call like .addMethod(functionPointer).

Thanks though! Doing what you suggest makes this work I think. Somehow, I’d gotten it into my head (idk from where) that because the func sig was vector&, I needed to declare those as &’s. Like a stack vs. heap pass issue.

Anyway, that was my REAL problem, because I tried what you’d suggested about but that doesn’t initialize the reference. You need to explicitly call the constructor, but then when I put anything in the constructor’s args to disambiguate from being a forward decl, it failed with some other error about ‘temporary’s.

So in a sense, I still don’t understand what is going on here fully, but I thank you heartily for fixing my problem. if anyone wants to supply some additional elucidation for the benefit of me and future google people, that would be great.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T23:47:33+00:00Added an answer on May 11, 2026 at 11:47 pm

    This:

     Vector<char, sizeof 'a'>& sourceData();
    

    has declared a global function which takes no arguments and returns a reference to Vector. The name sourceData is therefore of function type. When you try to access a member of that, it rightfully complains that it’s not a class/struct/union, and operator-> is simply inapplicable.

    To create an object instead, you should omit the parentheses (they are only required when you have any arguments to pass to the constructor, and must be omitted if there are none):

     Vector<char, sizeof 'a'> sourceData;
    

    Then you can call append:

     sourceData.append('f');
    

    Note that dot is used rather than -> because you have an object, not a pointer to object.

    You do not need to do anything special to pass sourceData to a function that wants a Vector&. Just pass the variable – it will be passed by reference automatically:

     foobar(sourceData, targetData);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 211k
  • Answers 211k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Database Pros Relating cities to provinces and job announcements will… May 12, 2026 at 10:06 pm
  • Editorial Team
    Editorial Team added an answer Subversion is pretty thrifty when it comes to file space… May 12, 2026 at 10:06 pm
  • Editorial Team
    Editorial Team added an answer This: type Handler interface { ServeHTTP(*Conn, *Request) } says that… May 12, 2026 at 10:05 pm

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want use html5's new tag to play a wav file (currently only supported
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
In order to apply a triggered animation to all ToolTip s in my app,
I have a French site that I want to parse, but am running into

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.