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 8154359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:19:12+00:00 2026-06-06T16:19:12+00:00

I have a typedef inside a class from a c++ machine library (dlib) that

  • 0

I have a typedef inside a class from a c++ machine library (dlib) that looks like this:

typedef dlib::matrix<double, 64, 1> sample_type;

Except the 64 is actually a variable. I’d like the typedef to be visible throughout the class, but I want the second parameter (the 64) be an argument when the constructor is called. How can I achieve this, while keeping the typedef visible everywhere?

  • 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-06-06T16:19:15+00:00Added an answer on June 6, 2026 at 4:19 pm

    As a general case this is not possible. Although you might want to write the following:

    template <int matrix_size>
    struct sample_type : public dlib::matrix<double, matrix_size, 1>
    {
        sample_type data1;
        sample_type<16> data2;
    };
    
    sampe_type<32> var32;
    sampe_type<36> var36;
    

    Note that inside the template 2 data fields are defined. The first data field will be created with the current instantiation parameter. Second data field will be created using explicit parameter.

    As you see, inside the template it seems to be what you want, but outside only constants can be used.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this bit of code: typedef CComQIPtr<MSXML::IXMLDOMDocument2> XML_DocumentPtr; then inside some class: XML_DocumentPtr
I have a class with a few simple structs like this (simplified code) inside
Say inside of a class Card , you have declared typedef enum { CLUBS,
I have a class that represents an capture zone in a game. Inside of
I have a class that creates an object inside one public method. The object
I have class like so class some_class { public: some_type some_value; int some_function(double *a,
I have a class expecting a two parameters template, like this: template<template <class, class>
I have a template class which looks like the following: template <template <class TypeT>
I have typedef std::string OrderID; I would like to overload the operator ++ for
Assuming that I have a typedef declared in my .h file as such: typedef

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.