Search Results

Search found 1163 results on 47 pages for 'jeff'.

Page 24/47 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Visual Studio: How to attach a debugger dynamically to a specific process

    - by Jeff Cyr
    I am building an internal dev tool to manage different processes commonly used in our development environment. The tool show the list the monitored processes, indicate their running state and allow to start or stop each process. I'd like to add the functionality of attaching a debugger to a monitored process from my tool instead of going in 'Debug-Attach to process' in visual studio and finding the process. My goal is to have something like Debugger.Launch() that would show a list of the available visual studio. I can't use Debugger.Launch() because it lauches the debugger on the process that make the call. I would need something like Debugger.Launch(processId). Does anyone know how to acheive this functionality? A solution could be to implement a command in each monitored process to call Debugger.Launch() when the command is received from the monitoring tool, but I would prefer something that does not require to modify the code of the monitored processes. Side question: When using Debugger.Launch(), instances of Visual Studio that already have a debugger attached are not listed. Visual Studio is not limited to one attached debugger, you can attach on multiple process when using 'Debug - Attach to process'. Anyone know how to bypass this limitation when using Debugger.Launch() or an alternative?

    Read the article

  • Insert rownumber repeatedly in records in t-sql.

    - by jeff
    Hi, I want to insert a row number in a records like counting rows in a specific number of range. example output: RowNumber ID Name 1 20 a 2 21 b 3 22 c 1 23 d 2 24 e 3 25 f 1 26 g 2 27 h 3 28 i 1 29 j 2 30 k I rather to try using the rownumber() over (partition by order by column name) but my real records are not containing columns that will count into 1-3 rownumber. I already try to loop each of record to insert a row count 1-3 but this loop affects the performance of the query. The query will use for the RDL report, that is why as much as possible the performance of the query must be good. any suggestions are welcome. Thanks

    Read the article

  • Passing a string representing my format specifier into stringWithFormat and seeing issues

    - by Jeff
    If I call "[NSString stringWithFormat:@"Testing \n %@",variableString]"; I get what I would expect, which is Testing, followed by a new line, then the contents of variableString. However, if i try NSString *testString = @"Testing \n %@"; //forgive shorthand here [NSString stringWithFormat,testString,variableString] the output actually literally writes \n to the screen instead of a newline. any workaround to this? seems odd to me

    Read the article

  • EasyXDM passing data issue

    - by Jeff Ryan
    I'm using rpc with XDM, and I can send simple data back and forth easily between child and parent window. But it seems to be limited to simple strings and numbers. The demos on the site only use numbers. When I try to send a json ecoded string, I get a cross domain error. When I use cors, I can make ajax requests fine, but I can't display the child page in the iframe, because the data is returned and not rendered. My question is, how can I render an iframe, and pass complex data back and forth. Or maybe I am doing something wrong?

    Read the article

  • Why won't Silverlight handle the conversion of my custom float property

    - by Jeff Weber
    In a Silverlight 4 project I have a class that extends Canvas: public class AppendageCanvas : Canvas { public float Friction { get; set; } public float Restitution { get; set; } public float Density { get; set; } } I use this canvas in Blend by dragging it onto another control and setting the custom properties: When I run the app, I get the following error when InitializeComponent is called on the control containing my custom canvas: I'm not sure why Silverlight isn't able to convert this property from it's string representation in Xaml, to the float that it is. Anyone have any ideas?

    Read the article

  • NSUserDefaults loses 3 rows each time it's called

    - by Jeff Decker
    Hello Everyone! Brand new programmer here, so off-topic help/constructive criticism welcome. I am saving a default state (such as "New York") in a UIPickerView which is in a FlipSideView. It certainly saves for the first and second time I check to make sure it's the same state (I am clicking "done" and then "info" repeatedly), but on the third check the picker has moved up three states (to "New Hampshire") and then every time I check the picker progresses three more states. Here's the .h and .m files of the FlipSideViewController: #import <UIKit/UIKit.h> import "Calculator.h" @protocol FlipsideViewControllerDelegate; @interface FlipsideViewController : UIViewController { id delegate; UIPickerView *myPickerView; NSArray *pickerViewArray; } @property (nonatomic, assign) id delegate; @property (nonatomic, retain) UIPickerView *myPickerView; @property (nonatomic, retain) NSArray *pickerViewArray; (IBAction)done; @end @protocol FlipsideViewControllerDelegate - (void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller; @end import "FlipsideViewController.h" @implementation FlipsideViewController @synthesize delegate; @synthesize myPickerView, pickerViewArray; -(CGRect)pickerFrameWithSize:(CGSize)size;{ CGRect screenRect = [[UIScreen mainScreen] applicationFrame]; CGRect pickerRect = CGRectMake( 0.0, screenRect.size.height - size.height, size.width, size.height); return pickerRect; } (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor viewFlipsideBackgroundColor]; [self createPicker]; } -(void)viewWillAppear:(BOOL)animated;{ [super viewWillAppear:NO]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [myPickerView selectRow:[defaults integerForKey:@"pickerRow"] inComponent:0 animated:NO]; } -(void)createPicker;{ pickerViewArray = [[NSArray arrayWithObjects: @"Alabama",@"Alaska", @"Arizona",@"Arkansas",@"California",@"Colorado",@"Connecticut",@"Delaware", @"District of Columbia",@"Florida",@"Georgia",@"Hawaii",@"Idaho",@"Illinois",@"Indiana",@"Iowa", @"Kansas",@"Kentucky",@"Louisiana",@"Maine",@"Maryland",@"Massachusetts",@"Michigan", @"Minnesota",@"Mississippi",@"Missouri",@"Montana",@"Nebraska",@"Nevada",@"New Hampshire",@"New Jersey", @"New Mexico",@"New York",@"North Carolina",@"North Dakota",@"Ohio",@"Oklahoma", @"Oregon",@"Pennsylvania",@"Rhode Island",@"South Carolina",@"South Dakota",@"Tennessee", @"Texas",@"Utah",@"Vermont",@"Virginia",@"Washington",@"West Virginia",@"Wisconsin",@"Wyoming", nil] retain]; myPickerView = [[UIPickerView alloc] initWithFrame:CGRectZero]; CGSize pickerSize = [myPickerView sizeThatFits:CGSizeZero]; myPickerView.frame = [self pickerFrameWithSize:pickerSize]; myPickerView.autoresizingMask = UIViewAutoresizingFlexibleWidth; myPickerView.showsSelectionIndicator = YES; myPickerView.delegate = self; myPickerView.dataSource = self; [self.view addSubview:myPickerView]; } (IBAction)done { [self.delegate flipsideViewControllerDidFinish:self]; } pragma mark - pragma mark UIPickerViewDataSource (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults setInteger:row forKey:@"pickerRow"]; [defaults setObject:[pickerViewArray objectAtIndex:row] forKey:@"pickerString"]; return [pickerViewArray objectAtIndex:row]; } (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults setInteger:row forKey:@"pickerRow"]; [defaults setObject:[pickerViewArray objectAtIndex:row] forKey:@"pickerString"]; } (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component { return 240.0; } (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component { return 40.0; } (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { return [pickerViewArray count]; } (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { return 1; } call me mystified! Thanks for any help. Please let me know if I can make myself more clear...

    Read the article

  • IE 8 Errors for Group Permissions for access

    - by Jeff P.
    Hello, The company I work for is about to begin testing for a transition from IE6 to IE8. One of our main concerns is about using permissions to control intranet access to internal sites,etc. This was a problem we encountered during testing for IE7 and scrapped it all together. However, IE6 has more than its foot in the grave, its head is peeking out. Microsoft is only supporting IE6 until 2014 when they also abandon support for Windows XP. IE7 just came up with a box asking for you to enter your credentials. It didn't matter if you had permissions, it always said access denied. We have yet to begin testing but I was hoping someone has encountered this issue as well and may be able to shed some light on the subject.

    Read the article

  • Python: does it make sense to refactor this check into it's own method?

    - by Jeff Fry
    I'm still learning python. I just wrote this method to determine if a player has won a game of tic-tac-toe yet, given a board state like:'[['o','x','x'],['x','o','-'],['x','o','o']]' def hasWon(board): players = ['x', 'o'] for player in players: for row in board: if row.count(player) == 3: return player top, mid, low = board for i in range(3): if [ top[i],mid[i],low[i] ].count(player) == 3: return player if [top[0],mid[1],low[2]].count(player) == 3: return player if [top[2],mid[1],low[0]].count(player) == 3: return player return None It occurred to me that I check lists of 3 chars several times and could refactor the checking to its own method like so: def check(list, player): if list.count(player) == 3: return player ...but then realized that all that really does is change lines like: if [ top[i],mid[i],low[i] ].count(player) == 3: return player to: if check( [top[i],mid[i],low[i]], player ): return player ...which frankly doesn't seem like much of an improvement. Do you see a better way to refactor this? Or in general a more Pythonic option? I'd love to hear it!

    Read the article

  • conditional php help

    - by jeff
    How can I wrap this entire statement below in a condition? So If the variable $uprice = 0 then I don't want to to display any of the code below <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item- >getWeeeTaxAppliedAmount()): ?> <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?> <?php else: ?> <?php echo $this->helper('checkout')->formatPrice($_item- >getCalculationPrice()) ?> <?php endif; ?>

    Read the article

  • MySqlDataAdapter or MySqlDataReader for bulk transfer?

    - by Jeff Meatball Yang
    I'm using the MySql connector for .NET to copy data from MySql servers to SQL Server 2008. Has anyone experienced better performance using one of the following, versus the other? DataAdapter and calling Fill to a DataTable in chunks of 500 DataReader.Read to a DataTable in a loop of 500 I am then using SqlBulkCopy to load the 500 DataTable rows, then continue looping until the MySql record set is completely transferred. I am primarily concerned with using a reasonable amount of memory and completing in a short amount of time. Any help would be appreciated!

    Read the article

  • How to use OUTPUT statement inside a SQL trigger?

    - by Jeff Meatball Yang
    From MSDN: If a statement that includes an OUTPUT clause is used inside the body of a trigger, table aliases must be used to reference the trigger inserted and deleted tables to avoid duplicating column references with the INSERTED and DELETED tables associated with OUTPUT. Can someone give me an example of this? I'm not sure if this is correct: create trigger MyInterestingTrigger on TransactionalTable123 AFTER insert, update, delete AS declare @batchId table(batchId int) insert SomeBatch (batchDate, employeeId) output SomeBatch.INSERTED.batchId into @batchId insert HistoryTable select b.batchId, i.col1, i.col2, i.col3 from TransactionalTable123.inserted i cross join @batchId b

    Read the article

  • What data structures and algorithms are applied within data warehouse cubes?

    - by Jeff Meatball Yang
    I understand that cubes are optimized data structures for aggregating and "slicing" large amounts of data. I just don't know how they are implemented. I can imagine a lot of this technology is proprietary, but are there any resources that I could use to start implementing my own cube technology? Set theory and lots of math are probably involved (and welcome as suggestions!), but I'm primarily interested in implementations: the data structures and query algorithms. Thanks!

    Read the article

  • Generate SQL script to insert XML from files, using Powershell

    - by Jeff Meatball Yang
    I have a bunch of (50+) XML files in a directory that I would like to insert into a SQL server 2008 table. How can I create a SQL script from the command prompt or Powershell that will let me insert the files into a simple table with the following schema: XMLDataFiles ( xmlFileName varchar(255) , content xml ) All I need is for something to generate a script with a bunch of insert statements. Right now, I'm contemplating writing a silly little .NET console app to write the SQL script. Thanks.

    Read the article

  • UIView, UIScrollView and UITextFields problem calling Method

    - by Jeff Groby
    I have a view with several embedded UITextFields, this UIView is subordinated to a UIScrollView in IB. Each text field is supposed to invoke a method called updateText defined in the viewcontroller implementation file when the user is done editing the field. For some reason, the method updateText never gets invoked. Anyone have any ideas how to go about fixing this? The method fired off just fine when the UIScrollView was not present in the project but the keyboard would cover the text fields during input, which was annoying. Now my textfields move up above the keyboard when it appears, but won't fire off the method when done editing. Here is my implementation file: #import "MileMarkerViewController.h" @implementation MileMarkerViewController @synthesize scrollView,milemarkerLogDate,milemarkerDesc,milemarkerOdobeg,milemarkerOdoend,milemarkerBusiness,milemarkerPersonal,milemarker; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { // Initialization code } return self; } - (BOOL) textFieldShouldReturn: (UITextField*) theTextField { return [theTextField resignFirstResponder]; } - (void)viewDidLoad { [super viewDidLoad]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(keyboardWasShown:) name: UIKeyboardDidShowNotification object: nil]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(keyboardWasHidden:) name: UIKeyboardDidHideNotification object: nil]; keyboardShown = NO; // 1 [scrollView setContentSize: CGSizeMake( 320, 480)]; // 2 } - (void)keyboardWasShown:(NSNotification*)aNotification { if (keyboardShown) return; NSDictionary* info = [aNotification userInfo]; // Get the size of the keyboard. NSValue* aValue = [info objectForKey:UIKeyboardBoundsUserInfoKey]; CGSize keyboardSize = [aValue CGRectValue].size; // Resize the scroll view (which is the root view of the window) CGRect viewFrame = [scrollView frame]; viewFrame.size.height -= keyboardSize.height; scrollView.frame = viewFrame; // Scroll the active text field into view. CGRect textFieldRect = [activeField frame]; [scrollView scrollRectToVisible:textFieldRect animated:YES]; keyboardShown = YES; } - (void)keyboardWasHidden:(NSNotification*)aNotification { NSDictionary* info = [aNotification userInfo]; // Get the size of the keyboard. NSValue* aValue = [info objectForKey:UIKeyboardBoundsUserInfoKey]; CGSize keyboardSize = [aValue CGRectValue].size; // Reset the height of the scroll view to its original value CGRect viewFrame = [scrollView frame]; viewFrame.size.height += keyboardSize.height; [scrollView scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES]; scrollView.frame = viewFrame; keyboardShown = NO; } - (void)textFieldDidBeginEditing:(UITextField *)textField { activeField = textField; } - (void)textFieldDidEndEditing:(UITextField *)textField { activeField = nil; } - (IBAction)updateText:(id) sender { NSLog(@"You just entered: %@",self.milemarkerLogDate.text); self.milemarker.logdate = self.milemarkerLogDate.text; self.milemarker.desc = self.milemarkerDesc.text; self.milemarker.odobeg = self.milemarkerOdobeg.text; self.milemarker.odoend = self.milemarkerOdoend.text; self.milemarker.business = self.milemarkerBusiness.text; self.milemarker.personal = self.milemarkerPersonal.text; NSLog(@"Original textfield is set to: %@",self.milemarker.logdate); [self.milemarker updateText]; } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)dealloc { [super dealloc]; } @end

    Read the article

  • Making Javascript and HTML5 games

    - by Jeff Meatball Yang
    A long time ago (Netscape 4-era), I wrote Javascript-based games: Pong, Minesweeper, and John Conway's Life among them. I'm getting back into it, and want to get my hands even dirtier. I have a few games in mind: Axis & Allies clone, with rugged maps and complex rules. Tetris clone, possibly with real-time player-vs-player or player-vs-computer mode Breakout clone, with a couple weapons and particle velocities In all of these, I have only a few objectives: Use JavaScript and HTML 5 - it should run on Chrome, Safari, or maybe an iPad. Start small and simple, then build-up features. Learn something new about game design and implementation. So my questions are: How would you implement these games? Do you have any technology recommendations? If you've written these games, what was the hardest part? N.B. I also want to start from first-principles - if you recommend a framework/library, I would appreciate some theory or implementation details behind it. These games are different enough that I should learn something new from each one.

    Read the article

  • response.redirect to classic asp failing {Unable to evaluate expression because the code is optimize

    - by jeff
    I have the following code pasted below. For some reason, the response.redirect seems to be failing and it is maxing out the cpu on my server and just doesn't do anything. The .net code uploads the file fine, but does not redirect to the asp page to do the processing. I know this is absolute rubbish why would you have .net code redirecting to classic asp, it is a legacy app. I have tried putting false or true etc. at the end of the redirect as I have read other people have had issues with this. Please help as it's driving me insane! It's so strange, it runs locally on my machine but won't run on my server! I am getting the following error when I debugged remotely. {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.} (UPDATED) After debugging remotely and taking the redirect out of the try catch, I have found that the redirect is trying to get to the correct location but after it leaves the redirect is just seems to get lost. (almost as if it can't navigate away from the cobra_import project) back up a level to COBRA/pages. Why is this??? This has worked previously!!! public void btnUploadTheFile_Click(object Source, EventArgs evArgs) { //need to check that the uploaded file is an xls file. string strFileNameOnServer = "PJI3.txt"; string strBaseLocation = ConfigurationSettings.AppSettings["str_file_location"]; if ("" == strFileNameOnServer) { txtOutput.InnerHtml = "Error - a file name must be specified."; return; } if (null != uplTheFile.PostedFile) { try { uplTheFile.PostedFile.SaveAs(strBaseLocation+strFileNameOnServer); txtOutput.InnerHtml = "File <b>" + strBaseLocation+strFileNameOnServer+"</b> uploaded successfully"; Response.Redirect ("/COBRA/pages/sap_import_pji3_prc.asp"); } catch (Exception e) { txtOutput.InnerHtml = "Error saving <b>" + strBaseLocation+strFileNameOnServer+"</b><br>"+ e.ToString(); } } }

    Read the article

  • Eclipse and JavaFX? is it just me?

    - by jeff porter
    I'm looking at learning JavaFX. I've tried setting Eclipse to develop a small app and I've downloaded the Eclipse plugin. Eclipse JavaFX plugin BUT... it just seems, well, flakey. So I have 3 questions... 1: Is there a better plugin? 2: Or is there some great set of tutorials out there that I'm missing? 3: finally, is it meant to be easy to call Java code from FX? I'm stuggling, it there a good example somewhere? On questions 1 & 2, Eclipse underlines code in red that just shouln't be. For example.. see this image... Why does it underline bit of imports in red? I know this is little of an open ended question. So I guess my main question is this... Is my experiance of JavaFX and Eclipse the best I can hope for? Or am I missing something ? (and I'm not looking for a Yes/No response) :-) Just looking for a discussion on how best to learn/develop JavaFx.

    Read the article

  • What is the best way get and hold property reference by name in c#

    - by Jeff Weber
    I want to know if there is a better way (than what I'm currently doing) to obtain and hold a reference to a property in another object using only the object and property string names. Particularly, is there a better way to do this with the new dynamic functionality of .Net 4.0? Here is what I have right now. I have a "PropertyReference<T>" object that takes an object name and property name in the constructor. An Initialize() method uses reflection to find the object and property and stores the property Getter as an Action<T> and the property Setter as an Func<T>. When I want to actually call the property I do something like this: int x = _propertyReference.Get(); or _propertyReference.Set(2); Here is my PropertyReference<T> code. Please dissect and make suggestions for improvement. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; using System.Xml; namespace WindowsFormsApplication2 { public class PropertyReference<T> : IPropertyReference { public string ComponentName { get; set; } public string PropertyName { get; set; } public bool IsInitialized { get { return (_action != null && _func != null); } } Action<T> _action; Func<T> _func; public PropertyReference() { } public PropertyReference(string componentName, string propertyName) { ComponentName = componentName; PropertyName = propertyName; } public void Initialize(IEntity e) { Object component = e.GetByName(ComponentName); if (component == null) return; Type t = e.GetByName(ComponentName).GetType(); PropertyInfo pi = t.GetProperty(PropertyName); _action = (T a) => pi.SetValue(component, a, null); _func = () => (T)pi.GetValue(component, null); } public void Reset() { _action = null; _func = null; } public void Set(T value) { _action.Invoke(value); } public T Get() { return _func(); } } } Note: I can't use the "Emit" functionality as I need this code to work on the new Windows Phone 7 and that does not support Emit.

    Read the article

  • JavaFX: JNLP file error

    - by jeff porter
    Hello everyone, I'm getting the following error when I upload a JavaFX app to a website, but I don't get it locally. I'm presuming that I'm missing something like the 'codebase' tag, but I'm not sure where it goes, can anyone help me out please? Java Console error: exception: JNLP file error: iShout_Foxpro_browser.jnlp. Please make sure the file exists and check if "codebase" and "href" in the JNLP file are correct.. java.io.FileNotFoundException: JNLP file error: iShout_Foxpro_browser.jnlp. Please make sure the file exists and check if "codebase" and "href" in the JNLP file are correct. at sun.plugin2.applet.JNLP2Manager.loadJarFiles(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Exception: java.io.FileNotFoundException: JNLP file error: iShout_Foxpro_browser.jnlp. Please make sure the file exists and check if "codebase" and "href" in the JNLP file are correct. HTML file source... <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>app_one</title> </head> <body> <script src="http://dl.javafx.com/1.3/dtfx.js"></script> <script> javafx( { archive: "app_one.jar", draggable: true, width: 480, height: 320, code: "app.Main", name: "app_one" } );

    Read the article

  • SQLAlchemy - how to map against a read-only (or calculated) property

    - by Jeff Peck
    I'm trying to figure out how to map against a simple read-only property and have that property fire when I save to the database. A contrived example should make this more clear. First, a simple table: meta = MetaData() foo_table = Table('foo', meta, Column('id', String(3), primary_key=True), Column('description', String(64), nullable=False), Column('calculated_value', Integer, nullable=False), ) What I want to do is set up a class with a read-only property that will insert into the calculated_value column for me when I call session.commit()... import datetime def Foo(object): def __init__(self, id, description): self.id = id self.description = description @property def calculated_value(self): self._calculated_value = datetime.datetime.now().second + 10 return self._calculated_value According to the sqlalchemy docs, I think I am supposed to map this like so: mapper(Foo, foo_table, properties = { 'calculated_value' : synonym('_calculated_value', map_column=True) }) The problem with this is that _calculated_value is None until you access the calculated_value property. It appears that SQLAlchemy is not calling the property on insertion into the database, so I'm getting a None value instead. What is the correct way to map this so that the result of the "calculated_value" property is inserted into the foo table's "calculated_value" column?

    Read the article

  • Function signature-like expressions as C++ template arguments

    - by Jeff Lee
    I was looking at Don Clugston's FastDelegate mini-library and noticed a weird syntactical trick with the following structure: TemplateClass< void( int, int ) > Object; It almost appears as if a function signature is being used as an argument to a template instance declaration. This technique (whose presence in FastDelegate is apparently due to one Jody Hagins) was used to simplify the declaration of template instances with a semi-arbitrary number of template parameters. To wit, it allowed this something like the following: // A template with one parameter template<typename _T1> struct Object1 { _T1 m_member1; }; // A template with two parameters template<typename _T1, typename _T2> struct Object2 { _T1 m_member1; _T2 m_member2; }; // A forward declaration template<typename _Signature> struct Object; // Some derived types using "function signature"-style template parameters template<typename _Dummy, typename _T1> struct Object<_Dummy(_T1)> : public Object1<_T1> {}; template<typename _Dummy, typename _T1, typename _T2> struct Object<_Dummy(_T1, _T2)> : public Object2<_T1, _T2> {}; // A. "Vanilla" object declarations Object1<int> IntObjectA; Object2<int, char> IntCharObjectA; // B. Nifty, but equivalent, object declarations typedef void UnusedType; Object< UnusedType(int) > IntObjectB; Object< UnusedType(int, char) > IntCharObjectB; // C. Even niftier, and still equivalent, object declarations #define DeclareObject( ... ) Object< UnusedType( __VA_ARGS__ ) > DeclareObject( int ) IntObjectC; DeclareObject( int, char ) IntCharObjectC; Despite the real whiff of hackiness, I find this kind of spoofy emulation of variadic template arguments to be pretty mind-blowing. The real meat of this trick seems to be the fact that I can pass textual constructs like "Type1(Type2, Type3)" as arguments to templates. So here are my questions: How exactly does the compiler interpret this construct? Is it a function signature? Or, is it just a text pattern with parentheses in it? If the former, then does this imply that any arbitrary function signature is a valid type as far as the template processor is concerned? A follow-up question would be that since the above code sample is valid code, why doesn't the C++ standard just allow you to do something like the following, which is does not compile? template<typename _T1> struct Object { _T1 m_member1; }; // Note the class identifier is also "Object" template<typename _T1, typename _T2> struct Object { _T1 m_member1; _T2 m_member2; }; Object<int> IntObject; Object<int, char> IntCharObject;

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >